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

[µo°Ý] VBA ²¾°ÊÀx¦s®æ¦ì¸m¡A¥t¦s·sÀɤΧR°£

[µo°Ý] VBA ²¾°ÊÀx¦s®æ¦ì¸m¡A¥t¦s·sÀɤΧR°£

¤j®a¦n¡A§Ú²Ä¤@¦¸µo©«¡A¦pªG¦³¤°»ò¤£¹ïªº½Ð¨£½Ì
¦]¬°¨C¤ë³£­n¤W¥æ¤ëµ²³øªí¡A¤£·Q¦A°Å°Å¶K¶K¡A©Ò¥H¦b¹Á¸Õ¥Î¨â­Ó«ö¶s¸Ñ¨M¥¦­Ì ^^"
°ÝÃD
1) §Ú¥u¯à°µ¨ì°Å¶K²Ä¤@­Ó¤u§@­¶¡A¶K¤W«á«ç¼Ë¸Õ³£¤£¯à¥OÀx¦s®æ¦Û°Ê¸õ¨ì¤U¤@¦CªºªÅ®æ¤W¡A¥O¨ì¶K¤W²Ä¤G­Ó¤u§@ªíªº¸ê®Æ®É³£§â²Ä¤@­Ó¤u§@­¶¶K¤Wªº³£Âл\¤F /.\
2) §Ú¸ÕµÛ§â¶K¦nªº"¤ëµ²'ªº¤À­¶¥t¦s§@¤@­Ó·sªº¤u§@ªí¡A¨Ã¥B§â¤@¨Ö¦sÀɪº¥¨¶°«ü¥O¤Î¹Ï®×«ö¶s§R°£¡A¦ý§Ú¥u¯à°µ¨ì¶}¤F¤@­Ó·sÀɮסA¤£·|¦Û°Ê¦sÀɤΧR°£¥¨¶°«ü¥O¤Î¹Ï®×«ö¶s

¤Q¤À·PÁÂÀ°¦£

test save&clear.zip (18.78 KB)

¦^´_ 16# luhpro


    ÁÂÁ§Aªº¸Ñµª¡A¾ãÅé¨Ó»¡§Ú¤§©Ò¥H­n¤T­Ó°j°é¬O¦]¬°¤@­Ó¤À­¶µ¥©ó¤@±ø¥Í²£½u¡A¨C¤ë§À³£»Ý­n§â¦UµP¤lªº³fª«¤À§O°µ¦¨¤ëµ²ªí¡A©Ò¥H»Ý­n³o¼Ë°j°é¡AÁÂÁÂÀ°¦£

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2020-12-28 21:43 ½s¿è
¦^´_  ­ã´£³¡ªL

¤£¦n·N«ä¡A§ÚÂà¾×¤F¨Ã¦A¤W¶Ç¡A³Â·Ð¤F
lovenice831 µoªí©ó 2020-12-28 10:49

§Úı±o§Aªºµ{¦¡°ÝÃDÀ³¸Ó¤£¦b¨º¸Ì³á.

¥H¤U¬Oµ{¦¡¤º®e:
  1. Sub Monthly()
  2. Dim xS As Worksheet, T$, i&, xE As Range
  3. Call clean
  4. Set xS = Sheets("Monthly")
  5. If xS.[j2] = "" Then MsgBox "please choose!  ": Exit Sub
  6. For i = 1 To 3
  7.     With Sheets(1)
  8.          If .FilterMode Then .ShowAllData
  9.          .[c8].AutoFilter Field:=1, Criteria1:=xS.[j2]
  10.           Set xE = xS.Cells(Rows.Count, 1).End(xlUp)(5)
  11.          .AutoFilter.Range.Offset(1, 2).Resize(, 30).Copy xE
  12.          .ShowAllData
  13.          End With
  14. Next i
  15. End Sub
½Æ»s¥N½X
§Ú·Q°ÝÃDÀ³¸Ó¦b©ó :
.[c8].AutoFilter Field:=1, Criteria1:=xS.[j2] «á­±ªº Criteria1:=xS.[j2],
§Aªº¿z¿ïÁä­È³£¬O¬Û¦Pªº(¦]¬°xSªº[j2]ªº­È¤£·|ÅÜ,¦bµ{¦¡¤¤³o®æ¤l¤ºªº­È¥²¶·¥ÑUser¤â°Ê°µÅܧó)
·íªì´N¤£¤Ó¤F¸Ñ§A3­Ó°j°é«ç»ò³£¬O§ì¬Û¦Pªº¸ê®Æ?

²{¦b¨Ì§Aªº±Ô­z,
§Ú·Q§A§ï¦¨³o¼Ë¸Õ¸Õ:
Dim xS As Worksheet, T$, i&, xE As Range, vPro()
vPro = Array("A", "B", "C")

......
For i =  0 To 2
......
.[c8].AutoFilter Field:=1, Criteria1:=vPro(i)

TOP

¦^´_ 14# ­ã´£³¡ªL
¦nªº¡A§Ú¦A¸Õ¤@¤U¡A¤£¦n·N«ä¡A³Â·Ð§A¤F

TOP

¦^´_ 13# lovenice831


¤@¼Ë¥´¤£¶},
WITH SHEETS(1)
À³¸Ó¬O
WITH SHEETS(i)

TOP

¦^´_ 10# ­ã´£³¡ªL

¤£¦n·N«ä¡A§ÚÂà¾×¤F¨Ã¦A¤W¶Ç¡A³Â·Ð¤F  
test Inventory.rar (237 KB)

TOP

¦^´_ 11# luhpro


    ¥ýÁ¹L¡A§Ú¸ÕÂà1 ¡A¦ýÂà¤@«á¥u¯àÅã¥ÜA ªºµ²ªG¡AB ©MC ªº³£¨ÌµM¬OªÅ¥Õ

TOP

¦^´_  ­ã´£³¡ªL
ÁÂÁÂÀ°¦£¡A¦ý§Ú¤£ª¾¥X²{¤°»ò°ÝÃD¡A¸ÕµÛ¸ÕµÛ¡A²{¦b¥þ³£¥Î¤£¨ì¡A³Â·ÐÀ°¦£¬d¬Ý¤@¤U¡AÁÂÁÂ
...
lovenice831 µoªí©ó 2020-12-26 20:13

Monthlyµ{¦¡.jpg

.[c8].AutoFilter Field:=1, Criteria1:=xS.[j2]

¸Õ¸Õ¬Ý...

TOP

¦^´_ 9# lovenice831


§ÚªºÂª©excel¥´¤£¶}ªþ¥ó,
¬Ý§O¤H¯à§_À°¦£~~

TOP

¦^´_ 8# ­ã´£³¡ªL
ÁÂÁÂÀ°¦£¡A¦ý§Ú¤£ª¾¥X²{¤°»ò°ÝÃD¡A¸ÕµÛ¸ÕµÛ¡A²{¦b¥þ³£¥Î¤£¨ì¡A³Â·ÐÀ°¦£¬d¬Ý¤@¤U¡AÁÂÁÂ


    test Inventory.rar (486.34 KB)

TOP

        ÀR«ä¦Û¦b : ¦Y­W¤F­W¡B­WºÉ¤Ü¨Ó¡A¨ÉºÖ¤FºÖ¡BºÖºÉ´d¨Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD