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

choose and union ºÃ°Ý

choose and union ºÃ°Ý

¦bVBA µ{¦¡¤¤ ¨Ï¥Îset n=choose(h,union(y,x),union(y1,x),union(y2,x)) ,°õ¦æ®É,¦¹¦a¤è·|¦³°ÝÃD,½Ð±Ð­þ¸Ì¦³°ÝÃD
¸Ô²Óµ{¦¡¦p¤U:
Dim x As Range, Y As Range, rng As Range, r As Long '«Å§iÅܼÆ
Dim y1 As Range, y2 As Range
For h = 1 To 3
r = Cells(65536, 52 + h).End(xlUp).Row '¨úªºAÄæ³Ì¤j¦C¦ì
Set m = Choose(h, Y, y1, y2)
Set rng = Range("ba2:ba" & r) '¨ú±o¸ê®Æ½d³ò
For Each x In rng '¸ê®Æ½d³ò¤º¨C¤@Àx¦s®æ
If x = "" Then '­YÀx¦s®æ­È¬° ""
If m Is Nothing Then 'Y­Y¤£¦s¦b
Set m = x  '±NY³]©w¬°x
Else '­YY¦s¦b
Set n = Choose(h, "Union(Y, x)", "Union(y1, x)", "Union(y2, x)")
  m = n
  End If
End If
Next
If Not m Is Nothing Then m.Delete (xlUp) '­YY¦s¦b±NY§R°£
Next

Set n = Choose(h, "Union(Y, x)", "Union(y1, x)", "Union(y2, x)")
³o¼Ë¬O¦r¦ê"Union(Y, x)", "Union(y1, x)", "Union(y2, x)"
¥ÎSET´N¥X¿ù
set n=choose(h,union(y,x),union(y1,x),union(y2,x))
°ò¥»»yªk¬O¨S¿ù,¦ý¬O¤@¥¹x,y,y1,y2¨ä¤¤¤S¤@­Ó¬Onothing¤]·|¥X¿ù
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 2# Hsieh
§Ú­nªí¹Fªº«D¦r¦ê,©Ò¥H­×§ï¬°,Set n = Choose(h, Union(Y, x), Union(y1, x), Union(y2, x)),¦ý­YX,Y,Y1,Y2 ¦³1¦U¬Onothing ¤@¼Ë·|¦³°ÝÃD,
³o¼Ëªº¸Ü§Ú­n¦p¦ó­×§ï©O?
§Ú·Q­nªº¬O,·íh=1,«hn=uniob(Y,X),·íh=2,n= Union(y1, x),¨Ì¦¹Ãþ±À,©Ò¥H·Q½Ð°Ý¦³¤°»ò¤èªk¥i¥H§JªA©O?

TOP

¦^´_ 3# jntseng
½Ð¥ý¦^ÀY¬Ý1¼Óªºµ{¦¡½X
Dim y1 As Range, y2 As Range
'
'
Set m = Choose(h, Y, y1, y2)
'
'
¤§«á ¾ã­Óµ{§Ç¤¤¨Ã¨S¦³³]©w¨ì y1, y2 ¬°¦ó³B???
­ì¥»Set n = Choose(h, "Union(Y, x)", "Union(y1, x)", "Union(y2, x)")
ÁöµM­×§ï¦¨ Set n = Choose(h, Union(Y, x)", "Union(y1, x)", "Union(y2, x))
ÁÙ¬O·|¥X¿ù
©Ò¥H½Ð§A­n¥ý«ü¥X y1, y2 ­n¦p¦ó³]©w

TOP

¦^´_ 4# GBKEE
§Ú¥i¥H§ï¬°¤U­±ªº¼gªk¶Ü? ³o¼Ë¬O¤£¬O´N«ü©w¤FY,y1,y2
Set n = Choose(h,Y= Union(Y, x), y1=Union(y1, x), y2=Union(y2, x))

TOP

UNION¨ç¼Æªº°Ñ¼Æ¤£®e³\NOTHING
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_  GBKEE
§Ú¥i¥H§ï¬°¤U­±ªº¼gªk¶Ü? ³o¼Ë¬O¤£¬O´N«ü©w¤FY,y1,y2
Set n = Choose(h,Y= Union(Y, x), y1=Union(y1, x), y2=Union(y2, x))jntseng µoªí©ó 2010-8-10 00:01

§Aªºµ{¦¡¤¤ Dim y1 As Range, y2 As Range  ´N¬O«ü©wÅܼƠ y1,y2 ¬°Rangeª«¥ó
¦ý§Aªºµ{¦¡¤¤©l²×¨S¦³³]©w¨ìy1,y2 ¬°Rangeª«¥ó  ¨Ò: Set y1=Range("a5") µ¥  ¬G y1,y2 ¦bµ{¦¡¤¤¬O Nothing
©Ò¥HHsiehªO¥D»¡
UNION¨ç¼Æªº°Ñ¼Æ¤£®e³\NOTHING
Hsieh µoªí©ó 2010-8-10 00:07

Hsiehªº

TOP

¦^´_ 7# GBKEE
ÁÂÁ«ü¾É,§Úª¾¹D§Úªº°ÝÃD¤F

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¯Ê¤fªºªM¤l¡A¦pªG´«¤@­Ó¨¤«×¬Ý¥¦¡A¥¦¤´µM¬O¶êªº¡C
ªð¦^¦Cªí ¤W¤@¥DÃD