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

[µo°Ý] excel vba °}¦C¤¤ªº¸ê®Æ¦p¦ó¥áµ¹¤@­Ó¥t¥~©w¸qªºRANGE

[µo°Ý] excel vba °}¦C¤¤ªº¸ê®Æ¦p¦ó¥áµ¹¤@­Ó¥t¥~©w¸qªºRANGE

¥»©«³Ì«á¥Ñ alexlkklin ©ó 2012-12-1 21:25 ½s¿è

¦U¦ì¤j¤j,

¤pªº¥Ø«e¦b½m²ß°}¦Cªº¹B¥Î,
¥Ñ©ó¬O§â²{¦æ¤â¤Wªºµ{¦¡®³¨Ó­×§ï,
©Ò¥H¦³¨Ç¦a¤è¤£²M·¡­n«ç»ò­×§ï,
½Ð¦U¦ì¤j¤j«ü¾É,
ÁÂÁÂ!!!

³o­Ó¬O§Ú§â¤@±iªí¥á¤W¦Û©wªº°}¦C¤¤
TBOMcl = Sheets("ªí1").Range("a1").End(xlToRight).Column
TBOMro = Sheets("ªí1").Range("a65535").End(xlUp).Row     

¦b¸g¹L¤@¨t¦Cªº¹Bºâ«á,§Ú­n§â°}¦C¤¤ªº¤@Äæ¨ú¥X°µSUMIFªº¹Bºâ
Set rg7po = Range(Sheets("ªí1").[q2], Sheets("ªí1").[q65535].End(xlUp)) [³o¦æ¬O§Ú­ì¥»©w¸q°µSUMIF¯Á¤Þ­Èªº]
¤pªºªº°ÝÃD¨Ó¤F
Set rg7po = Range(Sheets("ªí1").[q2], Sheets("ªí1").[t65535].End(xlUp))
«ç»ò©w¸q=«á­±ªº³o­Ó³¡¥÷(³o­Ó¦b¥H«e¦b¤pªºÀɮפW¬O¤@­ÓSHEET,¥Ø«e¤v§â³o­ÓSHEETŪ¶i°}¦C¤¤)
ALK

¦^´_ 1# alexlkklin
¤£¬O«Ü½T©w§A¬O¤£¬O¦b°Ý³o­Ó...
°²³]§AªºArray¬Org7po , §A­n§âQÄæ¸ê®ÆŪ¨ìrg7po¸Ì­±
dim rg7po
rg7po = Application.Transpose(Range(Sheets("ªí1").[q2], Sheets("ªí1").[q65535].End(xlUp)))

´N¥i¥HŪ¨ì   rg7po(1), rg7po(2), ...  ¸Ì­±¤F

TOP

¦^´_ 2# stillfish00

¤j¤j,
¤pªºÀɮ׭쥻¬O°µ¤U¦Cªº«Å§i©w¸q:
Set rg7po = Range(Sheets("ªí1").[q2], Sheets("ªí1").[t65535].End(xlUp))
³o­Ó³¡¥÷¦b­ì¥ýªºµ{¦¡¤¤¬Oµ¹sumif¥Î¨Ó°µ¯Á¤Þªº³¡¥÷,
¥Ñ©ó³Ìªñ¶}©l±µÄ²"°}¦C"³o­Ó³¡¥÷,
©Ò¥H·Q§â­ì¨Óªºµ{¦¡°µ­×§ï....
¤pªºÀɮצ³¦h±iªí,
ªí¤@¬O¥Î¨Ó¶×Á`·Q­nªº¸ê®Æ:¨Ò¦p-²£«~«~¸¹/®w¦s/¤u³æ.......
ªí¤G¬O®w¦sª¬ªpªí
ªí¤T...ªí¥|....ªí¤­......temp
§Ú³£¬O§â¦U¶µ¬ÛÃöªº¸ê®Æ°µ¹Bºâ«á¶×Á`¨ìªí¤@¤W,
²{¦bªºª¬ªp¬O·í§Ú§â¾ã²z¦nªº²£«~«~¸¹¥á¨ì°}¦C®É,
§Ú·Q­n§â­ì¥ýªºSet rg7po = Range(Sheets("ªí1").[q2], Sheets("ªí1").[t65535].End(xlUp)) °µ­×§ï±¼
rg7po¬O°µrangeªº³]©w
Range(Sheets("ªí1").[q2], Sheets("ªí1").[t65535].End(xlUp))³o¦æ«ç»ò§â¥¦Åܦ¨°}¦C???
ALK

TOP

¦^´_ 3# alexlkklin
¨º¨S¿ù°Ú , ¦A©w¸q¤@­ÓArrÅܼÆ
Arr = Application.Transpose(Range(Sheets("ªí1").[q2], Sheets("ªí1").[q65535].End(xlUp)))
³o¼Ë´N¥i¥H±NQÄ檺¸ê®ÆÂର¤@ºû°}¦C¤F

TOP

¦^´_ 3# alexlkklin
¦n¹³¤£¬O , ³o¦n¹³¸ò§Aµo°Ýªº¼ÐÃD¬Û¤Ï...
§A¦³´£¨ìsumif «ç»ò¤£§â¤½¦¡¦C¥X¨Ó
ÁÙ¦³§A¤w¸g¾ã²z¦nªº²£«~«~¸¹ ¬O©ñ¦b­þ?? ¬O¤u§@ªíÁÙ¬OÅܼƸÌ
³o¼Ë²q¯uªº«ÜÃøÀ´

TOP

¦^´_ 5# stillfish00

¤j¤j,
­ì©lµ{¦¡¦p¤U,
³o­Ó³¡¥÷¥Ø«e¦bÀɮפW³£¦³¹ê»Ú¹ïÀ³ªºSHEET¥h§@·~,
¥Ø«e§Ú¦b­×§ïªº´N¬O§â³o¨Ç"ªí"Âন"°}¦C"¥h¹Bºâ,
¤£ª¾¹D³o¼Ë¤l¤j¤j±z¦³¬ÝÀ´¤pªº°ÝÃD¶Ü?
³Â·Ð¤j¤j±z¤F,
ÁÂÁÂ!!!

Set rgpn = Range(Sheets("wh").[a2], Sheets("wh").[a65535].End(xlUp)) '®w¦s¸ê®Æ-®w¦s®Æ¸¹
Set rgw00 = Range(Sheets("wh").[j2], Sheets("wh").[j65535].End(xlUp)) '®w¦s¸ê®Æ-¦¨«~­Ü
Set rgw01 = Range(Sheets("wh").[i2], Sheets("wh").[i65535].End(xlUp)) '®w¦s¸ê®Æ-¹s¥ó­Ü

Set rgabpn = Range(Sheets("ªí1").[C2], Sheets("ªí1").[C65535].End(xlUp)) 'ªí1®Æ¸¹

cl = Sheets("ªí2").Range("L1").End(xlToRight).Column '¨úªí2³Ì«á¤@Äæ
z22 = Sheets("ªí1").Range("a65535").End(xlUp).Row
z33 = Sheets("ªí2").Range("a65535").End(xlUp).Row
For i = 2 To z33
pn = Sheets("ªí2").Range("a" & i)
stk00 = Application.SumIf(rgpn, pn, rgw00)
stk01 = Application.SumIf(rgpn, pn, rgw01)


ttqty = m02a + m01a + m011 + m015 + m019 + m011w + m015w + m019w
Sheets("ªí2").Range("K" & i) = ttqty
Next
For i = 12 To cl  ''''¥Ñªí2¨úA¥ó®Æ¸¹«á­pºâªí1¤Wªº»Ý¨D
    For j = 2 To z33
        Dim rgabqty As Range
        Set rgabqty = Range(Sheets("ªí1").Cells(2, i), Sheets("ªí1").Cells(z22, i)) '¯Ê®Æ¤ÀªRR«e¸m¸m§@·~-¯Ê®Æ«e¸mªºa²Õ¥óªº¦U¤é»Ý¨D
        awpn = Sheets("ªí2").Cells(j, 1) ' ¨úªí2ªº®Æ¸¹
        aqty = Application.SumIf(rgabpn, awpn, rgabqty) ''''¨úªí1¤WªºA¥ó³æ¤é»Ý¨D
        qty = Sheets("ªí2").Cells(j, i - 1)
ALK

TOP

¦^´_ 1# alexlkklin
¦b¸g¹L¤@¨t¦Cªº¹Bºâ«á,§Ú­n§â°}¦C¤¤ªº¤@Äæ¨ú¥X°µSUMIFªº¹Bºâ
SUMIFµLªk¹ï°}¦C¹Bºâ
»yªk SUMIF(range,criteria,sum_range)
Range    ¬O­n­pºâ¥[Á`ªºÀx¦s®æ½d³ò¡C
Criteria    ¬O¥Î¥H¨M©w­n§_¦C¤J¥[Á`ªº·j´M·Ç«h¡A¥i¥H¬O¼Æ¦r¡Bªí¥Ü¦¡©Î¤å¦r¡C¨Ò¦p¡Acriteia ¥i¥H¬O 32¡B"32"¡B">32" ©Î "apples"¡C
Sum_range    ¬O¹ê»Ú­n¥[Á`ªºÀx¦s®æ¡C

TOP

        ÀR«ä¦Û¦b : «Ý¤H°h¤@¨B¡A·R¤H¼e¤@¤o¡A´N·|¬¡±o«Ü§Ö¼Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD