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

¦³ÃöÂà¶K¤å³¹"For...Next »P For Each...Next °j°éªº°ò¥»·§©À"ªº°ÝÃD

¦³ÃöÂà¶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

¥»©«³Ì«á¥Ñ 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... ¥u­n¬O"ª«¥ó"´N»Ý­n¥Îset~
­Y¬O§Ú¦^µª¡A¨Ï±zº¡·N¡A½Ð±zÅý§Úª¾¹D¡I                  
­Y¬O§Úªº¦^ÂСA±z¤´¦³¨ä¥L¨£¸Ñ¡A¤]½Ð±z¤£¶Þ«ü±Ð¡I

TOP

¦^´_ 2# Min


    ¤F¸Ñ¤F~~~
·P®¦³á~~~~

TOP

        ÀR«ä¦Û¦b : ÁÀ¨¥¹³¤@¦·²±¶}ªºÂAªá¡A¥~ªí¬üÄR¡A¥Í©Rµu¼È¡C
ªð¦^¦Cªí ¤W¤@¥DÃD