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

±qA EXCEL ÀɱN¸ê®Æ¼g¦Ü B EXCELÀɤ¤

±qA EXCEL ÀɱN¸ê®Æ¼g¦Ü B EXCELÀɤ¤

¦U¦ì«e½ú,

½Ð±Ð¦U¦ì«e½ú
­n±N A.XLS¤¤ ªº "©±¦W" ¤u§@ªí ¤ºªº A2:An ,  n ªí¥Ü¤£ª¾¹D·|¦³´X¶¡©±
¼g¤JB.XLS¤¤ªº "·~ÁZ²Î­p" ¤u§@ªí ªº A3 : An+1 ¤º
¤£ª¾¹D EXCEL VBA ­n¦p¦ó¼¶¼g? (VBAµ{¦¡¼g¦b B.XLS ¤¤)

³o¸Ì­±§Úªº§xÃøÂI¦b
1¡B¤£¦PEXCELÀɮתº¸ê®ÆŪ¨ú¹B§@¤è¦¡?
2¡B­n¦p¦óºâ A.XLS ¦@¦³´X®a©± ?
3¡B¶i¶¥°ÝÃD¡A¦pªGA¦³­«½Æ©±¦W¡A­n¦p¦ó§PÂ_¡H(¦]¬°B.XLS ©±¦W¤£¥i­«½Æ)

¥ýÁÂÁ«e½ú

¦^´_ 1# ooctiger

A,B ¤w¶}±Ò¤Uªºµ{¦¡½X
  1. Option Explicit
  2. Sub Ex()
  3.     Dim D As Object, i As Integer
  4.     Set D = CreateObject("SCRIPTING.DICTIONARY") '¦r¨åª«¥ó
  5.     '1¡B¤£¦PEXCELÀɮתº¸ê®ÆŪ¨ú¹B§@¤è¦¡?
  6.     With Workbooks("a.xls").Sheets("©±¦W")
  7.         i = 2
  8.         Do While .Cells(i, "a") <> ""
  9.             D(.Cells(i, "a").Value) = ""
  10.             '3¡B¶i¶¥°ÝÃD¡A¦pªGA¦³­«½Æ©±¦W¡A­n¦p¦ó§PÂ_¡H(¦]¬°B.XLS ©±¦W¤£¥i­«½Æ)
  11.             '¦pªGA¦³­«½Æ©±¦W,¦r¨åª«¥ó¥u¨ú³Ì«áªº©±¦W
  12.             i = i + 1
  13.         Loop
  14.         MsgBox i - 2 '2¡B­n¦p¦óºâ A.XLS ¦@¦³´X®a©± ?
  15.     End With
  16.     With Workbooks("B.xls").Sheets("·~ÁZ²Î­p").Range("A3")
  17.         .Resize(D.Count) = Application.WorksheetFunction.Transpose(D.KEYS)
  18.     End With
  19. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ ooctiger ©ó 2015-5-7 16:15 ½s¿è

¦^´_ 2# GBKEE

¦pªGA.xls ¬O '¥¼¶}±Ò' ªº±¡ªp¤U¡Aµ{¦¡­n¦p¦ó­×§ï
°²³] A.xls ¬O©ñ¦b C:\temp ¤U

¥t¥~µ{¦¡½X²Ä17¦æ
    .Resize(D.Count) = Application.WorksheetFunction.Transpose(D.KEYS)
¡A¥i§_½ÐGBKEEµy§@¸ÑÄÀ¡A¨Ã´£¨Ñ¥i¥H¬d¸ß¨ìªººô­¶¡C

¹ê¦b¬O·s¤â. ³s­n«ç»ò¥h·j´M³£ÁÙ¬O°ÝÃD   
ÁÂÁÂ

TOP

¦^´_ 3# ooctiger

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

TOP

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2015-5-7 20:23 ½s¿è

¦^´_ 3# ooctiger
GOOGLE·j´M transpose  , ¥Îsite«ü©w¥»½×¾Â , ¦p¤U
https://www.google.com.tw/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=transpose+site:forum.twbts.com
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¦^´_ 5# stillfish00


    stillfish00 ¤j¤j¯u¬O¤Ó»Å¤F,ÁÙ¦³³oºØ¤è¦¡,±q±z¨­¤W¯uªº¾Ç¨ì«Ü¦hªF¦è©O!©~µMÁÙ¥i¥H«ü©wºô¯¸·j´M
PKKO

TOP

        ÀR«ä¦Û¦b : ¤£©È¨Æ¦h¡A¥u©È¦h¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD