ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

½ÐÀ°¦£Â½Ä¶¤@¤Uµ{¦¡

¦^´_ 34# GBKEE


     e = Worksheets("customer").Range("A" & Worksheets("customer").Rows.Count).End(xlUp).Row

TOP

¦^´_ 33# 198188
§A¶·¾Ç·|µ{¦¡½Xªº°»¿ù.
VBAµøµ¡¤¤,·Æ¹«²¾¨ì¦³¿ù»~ªºµ{§Ç,«öF8³v¦æ°õ¦æ¨Ó¬Ý±N,¬O¨º¤@¦æµ{¦¡½Xªºµo¥Í¿ù»~.

·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 32# GBKEE


    ¥X²{run-time error'9' subscript out of range

TOP

¦^´_ 31# 198188
Cells(¦C¼Æ, Äæ¼Æ)
   
With Worksheets("customer").Range(Cells(1, 11), Cells( e,12))
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 23# GBKEE


    ½Ð°Ý With Worksheets("customer").Range(Cells(1, 11), Cells(12, e))³o¥y¬O§_¦³°ÝÃD¡H§Ú·Q±Nrange³]©w¤£©T©w¥ÑA11¶}©l¨ìLÄæ³Ì«á¤@¦Cµe®Ø½u
e = Worksheets("customer").Range("A" & Worksheets("customer").Rows.Count).End(xlUp).Row
With Worksheets("customer").Range(Cells(1, 11), Cells(12, e))
.Borders.LineStyle = 1

.Borders.LineStyle = 1

.Borders.ColorIndex = 0

.BorderAround , 2, 0
End With

TOP

[/code][b]¦^´_ [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=48297&ptid=8531]29#[/url] [i]stillfish00[/i] [/b]
[code]Option Explicit

Sub ex()

    Dim FRng As Range, Wb As Workbook

    Dim A As Range, Rng As Range

    Dim fs As String, xi As Integer
    Dim i As Integer
    Dim j As Integer
    Dim k As Integer
    i = Worksheets("outstanding payments").Range("A" & Worksheets("outstanding payments").Rows.Count).End(xlUp).Row
    fs = "C:\Users\patrick.HKG\Desktop\payment report 2012.xlsx"
    Set Wb = Workbooks.Open(fs)
   
   
   
    With Worksheets("New form of payment report")
      j = Worksheets("New form of payment report").Range("E" & Worksheets("New form of payment report").Rows.Count).End(xlUp).Row
   
    End With
   
    Do
   
    ThisWorkbook.Activate
   
    If Wb.Worksheets("New form of payment report").Range("k" & j).Value = Date And Wb.Worksheets("New form of payment report").Range("h" & j).Value >= 0.95 Then
   
    If IsError(Application.VLookup(Wb.Worksheets("New form of payment report").Range("B" & j).Value, Worksheets("outstanding payments").Range("A:A"), 1, False)) Then
   
    Worksheets("outstanding payments").Range("A" & i + 1) = Wb.Worksheets("New form of payment report").Range("B" & j).Value
    Worksheets("outstanding payments").Range("F" & i + 1) = Wb.Worksheets("New form of payment report").Range("K" & j).Value
    End If
    i = i + 1
    End If
    j = j - 1
   
   Loop While j = 2
   
   
   Wb.Close 0
End Sub


¥i¥Hvlookup ¥X¨Ó¤F¡A¦ý¬O¥u¦³³Ì«á¤@­Ó¡H
DO
Loop While
³o¥y¬O¤£¬O§Ú¼g¿ù¤F¡H

TOP

¦^´_ 28# 198188
³Ì²³æªº¤èªk´N¬O15¦æ©³¤U¥[¤WThisWorkbook.Activate ,
©Î§A³£§ï¦¨¼g ThisWorkBook.Worksheets("New form of payment report") ¤]¥i¥H
¦]¬° Workbooks.Open ·|§ïÅÜ·í«e§@¥Î¤¤ªº¬¡­¶Ã¯
§Ú¼g¤Fcode´ú¸Õ
  1. 'Codes In a.xlsm
  2. Sub test()    Dim wb, fstr As String
  3.     fstr = "C:/b.xlsm"
  4.    
  5.     Set wb = Workbooks.Open(fstr)  
  6.     Debug.Print ThisWorkbook.Name         'will print a.xlsm
  7.     Debug.Print ActiveWorkbook.Name     'will print b.xlsm
  8.     Debug.Print Sheets.Parent.Name           'will print b.xlsm
  9.     wb.Close 0
  10. End Sub
½Æ»s¥N½X
§Úµoı§Ú«e­±(#22)»¡ªº¦n¹³¤]¤£§¹¥þ¥¿½T
¤£¬O¥HCode¼g¦b­þ¨Ó°Ï§O¯à¤£¯à¬Ù²¤
À³¸Ó§ó¥¿¬°:
¨Ï¥ÎWorkSheets/Sheets»yªk«e­±¨S«ü©w¬¡­¶Ã¯®É ,
·|¦Û°Ê¨Ï¥Î·í®ÉActiveªº¬¡­¶Ã¯©³¤UªºWorkSheet

TOP

¦^´_ 27# stillfish00
  1. Option Explicit

  2. Sub ex()

  3.     Dim FRng As Range, Wb As Workbook

  4.     Dim A As Range, Rng As Range

  5.     Dim fs As String, xi As Integer
  6.     Dim i As Integer
  7.     Dim j As Integer
  8.     Dim k As Integer
  9.     i = Worksheets("outstanding payments").Range("A" & Worksheets("outstanding payments").Rows.Count).End(xlUp).Row
  10.     fs = "C:\Documents and Settings\USER\®à­±\payment report 2012.xlsx"
  11.     Set Wb = Workbooks.Open(fs)
  12.    
  13.     With Worksheets("New form of payment report")
  14.       j = Worksheets("New form of payment report").Range("E" & Worksheets("New form of payment report").Rows.Count).End(xlUp).Row
  15.     End With
  16.    
  17.     Do
  18.         
  19.     If Wb.Worksheets("New form of payment report").Range("k" & j).Value = Date And Wb.Worksheets("New form of payment report").Range("h" & j).Value >= 0.95 Then
  20.    
  21.     If IsError(Application.VLookup(Wb.Worksheets("New form of payment report").Range("B" & j).Value, Worksheets("outstanding payments").Range("A:A"), 1, False)) Then
  22.    
  23.     Worksheets("outstanding payments").Range("A" & i + 1) = Wb.Worksheets("New form of payment report").Range("B" & j).Value
  24.     Worksheets("outstanding payments").Range("F" & i + 1) = Wb.Worksheets("New form of payment report").Range("H" & j).Value
  25.     End If
  26.      j = j - 1

  27.      i = i + 1
  28.     End If
  29.     Loop While j = 1
  30.    
  31.    Wb.Close 0
  32. End Sub
½Æ»s¥N½X
½Ð°Ý¤U­±³o¥y­þ¸Ì¥X¿ù¤F¡H °õ¦æ¶¥¬q¿ù»~¡¥9¡¦¡G°}¦C¯Á¤Þ¶W¥X½d³ò
If IsError(Application.VLookup(Wb.Worksheets("New form of payment report").Range("B" & j).Value, Worksheets("outstanding payments").Range("A:A"), 1, False)) Then

TOP

¦^´_ 26# 198188
¹ïªº

TOP

¦^´_ 25# stillfish00



  i =  Worksheets("Sheet1").Range("A" &  Worksheets("Sheet1").rows.count).end(xlup).value  + 1 ¬O«ü³Ì«á¤@µ§ªºÀx¦s®æ­È¥[1 ¡]¤ñ¦pA100¬O³Ì«á¤@µ§¡A¦ÓA100ªº­È¬O3¡A¨º»ò i = 4)
  i =  Worksheets("Sheet1").Range("A" &  Worksheets("Sheet1").rows.count).end(xlup).row  + 1 ¬O«ü³Ì«á¤@µ§¨º¦C¥[1 ¡]¤ñ¦pA100¬O³Ì«á¤@µ§¡A¨º»ò i = 101)

½Ð°Ý¬O¤£¬O³o­Ó·N«ä¡H

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¤Hªº§Ö¼Ö¡D¤£¬O¦]¬°¥L¾Ö¦³±o¦h¡A¦Ó¬O¦]¬°¥L­p¸û±o¤Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD