¦³ÃöÂà¶K¤å³¹"For...Next »P For Each...Next °j°éªº°ò¥»·§©À"ªº°ÝÃD
- ©«¤l
- 222
- ¥DÃD
- 56
- ºëµØ
- 0
- ¿n¤À
- 285
- ÂI¦W
- 0
- §@·~¨t²Î
- window
- ³nÅ骩¥»
- office2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-8-30
- ³Ì«áµn¿ý
- 2024-4-22
|
¦³ÃöÂà¶K¤å³¹"For...Next »P For Each...Next °j°éªº°ò¥»·§©À"ªº°ÝÃD
¦b"For...Next »P For Each...Next °j°éªº°ò¥»·§©À"¤@¤å¤¤µ{¦¡½X
Sub zz()
Set a = Workbooks("ÀÉ®×A.xls").Sheets(1)
Set b = Workbooks("ÀÉ®×B.xls").Sheets(1)
lastrow = a.[A1].End(xlDown).Row
lastcol = a.[A1].End(xlToRight).Column
##°ÝÃD ÅܼÆa.b¬°¦ó¨Ï¥Îset³]©w¬°ª«¥óÅܼÆ,¦Ólastcol©Mlastrow«o¤£¨Ï¥Îª«¥óÅܼÆset
«á±ªºÀ³¥Î¤Wlastcol©Mlastrowµø¬°þºØÅܼÆ?
rb = 1
For c = 2 To lastcol
¡@¡@For r = 2 To lastrow
¡@¡@¡@¡@If a.Cells(r, c) <> "" Then
¡@¡@¡@¡@¡@¡@b.Cells(rb, 3) = a.Cells(1, c)
¡@¡@¡@¡@¡@¡@b.Cells(rb, 4) = a.Cells(r, 1)
¡@¡@¡@¡@¡@¡@b.Cells(rb, 11) = a.Cells(r, c)
¡@¡@¡@¡@¡@¡@rb = rb + 1
¡@¡@¡@¡@End If
¡@¡@Next r
Next c
End Sub |
|
|
|
|
|
|
- ©«¤l
- 172
- ¥DÃD
- 39
- ºëµØ
- 20
- ¿n¤À
- 177
- ÂI¦W
- 0
- §@·~¨t²Î
- Microsoft Windows XP
- ³nÅ骩¥»
- Microsoft Office 2003
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- °ª¶¯
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2023-3-19
|
¥»©«³Ì«á¥Ñ Min ©ó 2010-9-5 19:36 ½s¿è
Set a = Workbooks("ÀÉ®×A.xls").Sheets(1)
Set b = Workbooks("ÀÉ®×B.xls").Sheets(1)
³o¥ó¬Oª«¥óÅܼƪü ¬O¤u§@ªíª«¥óªºÅܼÆ!
lastrow = a.[A1].End(xlDown).Row
lastcol = a.[A1].End(xlToRight).Column
¬O¼ÆÈÅÜ¼Æ ¦pinteger long...
¦Ü©ó¤°»ò®ÉÔn¥Îset... ¥un¬O"ª«¥ó"´N»Ýn¥Îset~ |
|
Y¬O§Ú¦^µª¡A¨Ï±zº¡·N¡A½Ð±zÅý§Úª¾¹D¡I
Y¬O§Úªº¦^ÂСA±z¤´¦³¨ä¥L¨£¸Ñ¡A¤]½Ð±z¤£¶Þ«ü±Ð¡I
|
|
|
|
|
- ©«¤l
- 222
- ¥DÃD
- 56
- ºëµØ
- 0
- ¿n¤À
- 285
- ÂI¦W
- 0
- §@·~¨t²Î
- window
- ³nÅ骩¥»
- office2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-8-30
- ³Ì«áµn¿ý
- 2024-4-22
|
¦^´_ 2# Min
¤F¸Ñ¤F~~~
·P®¦³á~~~~ |
|
|
|
|
|
|