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

[µo°Ý] ·j´M³Ì«á¤@¦C³£¦³¬Û¦P¼Æ¦rªº²Õ¦X¡C

¦^´_ 4# c_c_lai
ÁÂÁ±zªº¤£§[«ü¾É
­«·s»¡©ú¦p¤U¡J
BASE_T-1.rar (74.91 KB)
³Æµù¡J¥N¥Î¦Wµü»¡©ú
A²Õ¦X=RrngA InputBox¥ô¨ú¤@­Ó¶}¼úª©(DATA!)ªº´Á¼Æ¤Î¨ä¶ñ¤JCrngA InputBoxªºÄæ¦ì¼Æ¡C
B²Õ¦X=RrngB InputBox¥ô¨ú¤@­Ó¶}¼úª©(DATA!)ªº´Á¼Æ¤Î¨ä¶ñ¤JCrngB InputBoxªºÄæ¦ì¼Æ¡C
n= Ncount InputBox¶ñ¤JÅçÃÒª©ªº«ü©w¦¸¼Æ¡C
I = Number InputBox¶ñ¤J«ü©wªº¸¹½X¡C

³q«h¡J
RrngAªº´Á¼Æ¡ÕNrange´Á¼Æ¤~¦³®Ä¡ã°õ¦æ¡C
Rrng¢Ðªº´Á¼Æ¡ÕRrngA´Á¼Æ¤~¦³®Ä¡ã°õ¦æ¡C
·j´Mªº½d³ò=¥ÑStrRng InputBox¶ñ¤Jªº¦U´Á¼Æ¨ìNrange InputBox¶ñ¤Jªº¦U´Á¼Æ¬°¤î¡C

°ò¥»ÅÞ¿è¡J
¥HA²Õ¦X©ÎB²Õ¦X©ÎA*BªºÂù²Õ¦X~¦b·j´Mªº½d³ò¤º~
¥Ñ¨ä°ò·Ç¦C©¹¤W·j´M²Ä1­Ó¨ì²Än­Óªº¬Û¦P²Õ¦X(§YÅçÃÒª©)¡A
·í¸Ó²Õ¦Xªº²Ä1­Ó¨ì²Än­Óªº¬Û¦P²Õ¦X¤§³Ì«á¤@¦C(=Nrange´Á¼Æªº¹ïÀ³´Á¼Æ)~
³£¦³Åã¥Ü¥ô¤@­Ó(§t)¥H¤WªºI®É¡A«hÅÞ¿è±ø¥ó¦¨¥ß¡C

»Ý¨D¡J²£¥Í®ÄªGÀɤΨäSheet1®æ¦¡¤º®e¡C
1.·íA²Õ¦X©MB²Õ¦X©MA*BªºÂù²Õ¦Xµ¥³£²Å¦X°ò¥»Å޿誺±ø¥ó~¥B
¤T­Ó²Õ¦X¤§¦UÅçÃÒª©ªº³Ì«á¤@¦C(=Nrange´Á¼Æªº¹ïÀ³´Á¼Æ)¤]³£¦³Åã¥Ü¬Û¦PªºI®É¡A«h²£¥Í®ÄªGÀɮסC

2.¦WºÙ
Á`¸ê®Æ§¨¡JI_Nrange´Á_NUM_ RrngA _ CrngA¬P+RrngA _ CrngA¬P_ Ncount¦¸_ Number

¤À¸ê®Æ§¨¦WºÙ©M®ÄªGÀɮצWºÙ©M®ÄªGÀÉ®×Sheet1ªº¤º®e&®æ¦¡~~~~~~~~~~~
¸Ô¦p¦U½d¨ÒÀɪº¹Ï¥Ü©M»¡©ú¡CÁÂÁÂ!

TOP

¦^´_ 1# ziv976688
¼g¤F¤@­Ó´ú¸Õµ{¦¡¡A´£¨Ñ§A¤F¸Ñ ToSplit() ªºÀ³¥Î¡G
  1. Sub Test()
  2.     Dim txt As String, sp As Variant
  3.    
  4.     txt = "249-255,263,268"
  5.     sp = ToSplit(txt, ",")
  6.     MsgBox "249-255,263,268" & vbCrLf & Join(sp, ",")
  7.    
  8.     txt = "04,12,20-22,30,34,38,42,47"
  9.     sp = ToSplit(txt, ",")
  10.     MsgBox "04,12,20-22,30,34,38,42,47" & vbCrLf & Join(sp, ",")
  11. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2017-1-5 20:04 ½s¿è

¦^´_ 2# ziv976688 h0 dl3d04d04
°Ñ¦Ò¬Ý¬Ý¡I
¦]§Ú¤£À´³o¹CÀ¸³W«h¡A¥u±N§Aªºµ{¦¡½X²¤¤©¸Õ¼g¡A¤£ª¾¥i§_¡H
  1. Sub Ex()
  2.     Dim startrang%, endrang%, tim!, In1rr As Variant, In2rr As Variant, StrRng$, Ncount$, Number
  3.     Dim RrngA$, Nrange$, CrngA$, RrngB$, CrngB$, i%, j%, y%, num$, Order$, NUMX$
  4.     Dim m1%, sta%

  5.     StrRng = "1"                            '  InputBox("½Ð¿é¤JDATA!¦U·j´M¤ñ¹ïªº°_©l´Á¼Æ", "¿é¤J´Á¼Æ")
  6.     Nrange = "280"                          '  InputBox("½Ð¿é¤JDATA!¦U·j´M¤ñ¹ïªº¨´¤î(¶}¼ú)´Á¼Æ", "¿é¤J´Á¼Æ")
  7.     num = "50"                              '  InputBox("½Ð¿é¤J®ÄªGÀÉA¡JH½Æ»s½d³òªº´Á¶Z¼Æ", "¿é¤J¶Z´Á¼Æ")
  8.     RrngA = "253,268,273"                   '  InputBox("½Ð¿é¤J¦U"²Ä¤@­Ó"¤ñ¹ïªº"°ò·Ç´Á¼Æ", "¿é¤J²Ä¤@­Ó´Á¼Æ")
  9.     CrngA = "1-2"                           '  InputBox("½Ð¿é¤J¦U"²Ä¤@­Ó"¤ñ¹ïªº7Äæ¨ú¥ô1~6¤§Äæ¦ì¼Æ", "¿é¤JÄæ¦ì¼Æ(1~6)")
  10.     RrngB = "249-250,263,268"               '  InputBox("½Ð¿é¤J¦U"²Ä¤G­Ó"¤ñ¹ïªº"°ò·Ç´Á¼Æ", "¿é¤J²Ä¤G­Ó´Á¼Æ")
  11.     CrngB = "1-2"                           '  InputBox("½Ð¿é¤J¦U"²Ä¤G­Ó"¤ñ¹ïªº7Äæ¨ú¥ô1~6¤§Äæ¦ì¼Æ", "¿é¤JÄæ¦ì¼Æ(1~6))
  12.     Order = ""                              '  InputBox("½Ð¿é¤J¦A¿z¿ïÅÞ¿è±ø¥óªº°_¨´§Ç¸¹", "¿é¤J§Ç¸¹(1~99)©Î¤£¼W¥[(«öEnter)")
  13.     Number = "04,12,20-22,30,34,38,42,47"   '  InputBox("½Ð¿é¤J¦U«ü©wªº¸¹½X", "¿é¤J¸¹½X(1~49)")
  14.     Ncount = "2-3"                          '  InputBox("½Ð¿é¤JÅçÃÒª©ªº³sÄò¦¸¼Æ", "¿é¤J¦¸¼Æ(2~10)")
  15.    
  16.     tim = Timer
  17.     [L1:L10] = ""
  18.     NUMX = num
  19.     Application.DisplayAlerts = False
  20.     On Error Resume Next                    '  ±N¿ù»~³B²zªº¤è¦¡³]¬°¡uÄ~Äò¤U¤@¦æ¡v¡C
  21.     Application.ScreenUpdating = False      '  ¦b­I´º¤U°õ¦æ
  22.    
  23.     '  ...............
  24.     In1rr = ToSplit(Nrange, ",")
  25.    
  26.     '  ................
  27.     In2rr = ToSplit(NUMX, ",")
  28.     '  ................
  29.       
  30.     '  .......................
  31.     [L1] = Nrange & "=" & Format((Timer - tim) / 24 / 60 / 60, "hh:mm:ss")
  32.     [L2] = "DATA!¦U·j´M¤ñ¹ïªº°_©l´Á¼Æ=" & StrRng
  33.     [L3] = "A¡JH(¶}¼úª©)ªº´Á¶Z¼Æ=" & NUMX
  34.     [L4] = "¤ñ¹ï°ò·Ç´Á¼ÆA=" & RrngA
  35.     [L5] = "Äæ¦ì¼ÆA=" & CrngA
  36.     [L6] = "¤ñ¹ï°ò·Ç´Á¼ÆB=" & RrngB
  37.     [L7] = "Äæ¦ì¼ÆB=" & CrngB
  38.     [L8] = "¼W¥[¦A¿z¿ïÅÞ¿è±ø¥óªº§Ç¸¹=" & Order
  39.     [L9] = "¦U«ü©w¦P¸¹½X=" & Number
  40.     [L10] = "ÅçÃÒª©ªº³sÄò¦¸¼Æ=" & Ncount
  41. End Sub

  42. Function ToSplit(txt As String, sp As String, Optional dash As String = "-") As String()
  43.     Dim FullNameComma As Variant, cts As Integer, nxt As Integer
  44.     Dim lf As Integer, rt As Integer, spl As String


  45.     FullNameComma = Split(txt, sp)
  46.     spl = ""
  47.     For cts = LBound(FullNameComma) To UBound(FullNameComma)
  48.         nxt = InStr(FullNameComma(cts), dash)
  49.         If nxt > 0 Then
  50.             lf = Val(Left(FullNameComma(cts), nxt - 1))
  51.             rt = Val(Mid(FullNameComma(cts), nxt + 1))
  52.             For nxt = lf To rt
  53.                 spl = IIf(spl = "", CStr(nxt), spl & sp & CStr(nxt))
  54.             Next
  55.         Else
  56.             spl = IIf(spl = "", FullNameComma(cts), spl & sp & FullNameComma(cts))
  57.         End If
  58.     Next cts
  59.    
  60.     ToSplit = Split(spl, sp)
  61. End Function
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ ziv976688 ©ó 2017-1-5 11:26 ½s¿è

¸É¥R»¡©ú¡J
n=2¡A2¬P¹ï2¬P©Mn=3¡A1¬P¹ï2¬P¡Fn=3¡A2¬P¹ï1¬P¡Fn=3¡A2¬P¹ï2¬Pµ¥¡J¦]¥u¦C280´Á¡A©Ò¥H§ä¤£¨ì½d¨Ò¡A½Ð¨£½Ì!

«Øij¥ý¬Ý"¤å¦r»¡©ú"¡A¦A"©Ô¥X"I_280´Á_50_273-12+268-56_2¦¸_12,42.©MI_280´Á_50_273-4+250-6_3¦¸_38.
¦pªGÁÙµLªk²z¸Ñ»Ý¨D¡A¦A"©Ô¥X"¨ä¥¦½d¨Ò¨Ó¬Ý¡CÁÂÁÂ!

¹Ï¥Ü¤¤ªº¬yµ{»¡©ú¬O¤£¤~¥H"¤H¤u¤ñ¹ï"®Éªº·Pı¡J¥ý¤ñA©MB¡A·í¨ä¦¨¥ß«á~¦A¤ñA*B¡A®Ä²v·|¤ñ¸û§Ö¡C
¦ý¦b¹q¸£¶]µ{¦¡ªº¹ê°È¤W¬°¦ó?¤p§Ì¤£²M·¡¡F©Ò¥H²Õ¦X¤ñ¹ïªº"¬yµ{¶¶§Ç"¡J½Ð ¦U¦ì¤j¤j¾ÜÀu½s¼g¡CÁÂÁÂ!

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦pÆp¥Û¡j®É¶¡¹ï¤@­Ó¦³´¼¼zªº¤H¦Ó¨¥¡A´N¦pÆp¥Û¯ë¬Ã¶Q¡F¦ý¹ï·M¤H¨Ó»¡¡A«o¹³¬O¤@§âªd¤g¡A¤@ÂI»ù­È¤]¨S¦³¡C
ªð¦^¦Cªí ¤W¤@¥DÃD