¼ÐÃD:
½Ð±Ð¦U¦ì«e½ú vb
[¥´¦L¥»¶]
§@ªÌ:
duck_simon
®É¶¡:
2013-7-14 21:34
¼ÐÃD:
½Ð±Ð¦U¦ì«e½ú vb
½Ð±Ð¦U¦ì«e½ú vb ¦pªþ¥ó¤¤»¡©ú !
쬰®L¤j¤j ©Ò«ü¾É ![attach]15437[/attach]
§@ªÌ:
GBKEE
®É¶¡:
2013-7-15 14:46
¦^´_
1#
duck_simon
Function Bn(ByRef Rng As Range, ByRef No As Integer, ByRef x As String) As String
'ByRef ¿ï¾Ü©Ê¤Þ¼Æ¡Cªí¥Ü¥H¶Ç§}ªº¤è¦¡¨Ó¶Ç»¼¤Þ¼Æ¡CVisual Basic ¹w³]¬° ByRef
'ByVal ¿ï¾Ü©Ê¤Þ¼Æ¡Cªí¥Ü¥H¶ÇȪº¤è¦¡¨Ó¶Ç»¼¤Þ¼Æ¡C
'*** pºâªº½d³ò **** 'rng(°Ñ¼Æ) As(«¬ºA) Range
'Range ¶°¦X ¥Nªí¬Y¤@Àx¦s®æ¡B¬Y¤@Äæ¡B¬Y¤@¦C¡B¬Y¤@«ü©w½d³ò (¸Ó«ü©w½d³ò¥i¥]§t¤@Ó©ÎY¤z³sÄòÀx¦s®æ½d³ò) ©ÎªÌ¬Y¤@¥ßÅé½d³ò¡C
'*** «ü©w¤Q¦ì¼Æªº½d³ò(0 - 9) **** 'No(°Ñ¼Æ) As(«¬ºA) Integer
'Integer ¸ê®Æ«¬ºA: Integer ÅܼƫY¥H½d³ò¬° -32,768 ¨ì 32,767 ¤§ 16 ¦ì¤¸ (2 Ӧ줸²Õ) ¼Æ¦rªº§Î¦¡Àx¦s¡CInteger ªº«¬ºA«Å§i¦r¤¸¬O¦Ê¤À¤ñ²Å¸¹(%)¡C
'*** «ü©w¶¡¹j ¼Æ¦rªº¦r¦ê **** 'x(°Ñ¼Æ) As(«¬ºA) String
'String ¸ê®Æ«¬ºA: ©Ò§t¬°¤@³s¦ê¦r¤¸ªº¸ê®Æ«¬ºA¡A¨Ã¥B±N¨ä¸ÑÄÀ¬°¦r¤¸¦Ó¤£¬O¼ÆÈ¡C¦r¦ê¥i¥H¥]¬A¦r¥À¡B¼Æ¦r¡BªÅ¥Õ©M¼ÐÂI²Å¸¹¡CString ¸ê®Æ«¬ºA¥i¥H¦s©ñ±q 0 ¨ì 63K ©T©wªø«×ªº¦r¦ê¡A¤]¥i¦s¦¨±q 0 ¨ì¬ù 2 ¥ü¦r¤¸ªº°ÊºAªø«×¦r¤¸¡C¦b Visual Basic ¥i¥Î²Å¸¹ ($) ªº«¬ºA«Å§i¦r¤¸¨Óªí¥Ü¤@¦r¦ê¡C
Dim rn1 As Range 'Dim ³¯z¦¡ «Å§iÅܼơA¨Ã°t¸mÀx¦sªÅ¶¡¡C
'¦b¼Ò²Õ¼h¦¸ùØ¥H Dim ©Ò«Å§iªºÅܼơA¸Ó¼Ò²Õ©Ò¦³ªºµ{§Ç¬Ò¥i¨Ï¥Î¡C¦bµ{§Ç¼h¦¸«Å§iªºÅܼơA«h¥u¥i¦b¸Óµ{§Ç¤¤¨Ï¥Î¡C
If Application.Count(Rng) = 0 Then Bn = Rng.Address(0, 0) & " ¥²¶·¦³¼Æ¦r¸ê®Æ!! "
'Application.Count : ¤u§@ªí¨ç¼Æ Count
If No < 0 Or No > 9 Then Bn = Bn & "No:°Ñ¼Æ¥²¶·¬O 0 - 9"
If Bn <> "" Then Exit Function 'Â÷¶} ¦Ûq¨ç¼Æ
For Each rn1 In Rng 'rng(ª«¥ó)¶°¦X,¤¤ªº¤l¶°¦X -> rn1
If IsNumeric(rn1) And rn1 <> "" Then '¤l¶°¦X¥²¶·¬O¼Æ¦r,rn1 = ""-> IsNumeric(rn1)=True
If No = 0 And Len(rn1) = 1 Then 'Ó¦ì¼Æ
Bn = Bn & rn1 & x
ElseIf Len(rn1) = 2 And Mid(rn1, 1, 1) = No Then '¤Q¦ì¼Æ
Bn = Bn & rn1 & x
End If
End If
Next
Bn = Left(Bn, Len(Bn) - 1)
End Function
½Æ»s¥N½X
§@ªÌ:
duck_simon
®É¶¡:
2013-7-15 16:48
½Ð±Ð¬°¦ó¦b¤½¦¡Äæ µLªk«ö¤U ctrl+shift+enter ?? 2010
Åwªï¥úÁ{ ³Â»¶®a±Ú°Q½×ª©ª© (http://forum.twbts.com/)