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

[µo°Ý] ¸ê®Æ­åªR+¥[®Ø½u

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

½Ð°Ý¤@¤U, §Ú¦³¨Ì·Ó§ÚªºÃB¥~»Ý¨D°µ¤F¤@¨Ç¤p­×§ï, ·Q½Ð°Ý¤@¤U
¦pªG§Ú­n§PÂ_µe½uªº¸ê®ÆÄæ¦ì¦bDÄæ¦ì ,  §Ú¦p¦ó­×§ïÅý¥Lºâ¾ãµ§¸ê®Æªº³Ì«á¤@Äæ ??
¬O¥[¤J¤U­±³o¤@¬q¶Ü???
  1. .Range("D65536").End(xlUp).Row To 2 Step -1
½Æ»s¥N½X
¦A¨Ó§Ú­nµe½uªº½d³ò¬OA2Äæ¨ìAD2Äæ
  1. Dim xR As Range, xH As Range
  2. For Each xR In [D2:D3000]
  3.     If xH Is Nothing Then Set xH = xR
  4.     If xR(2) <> xR Then
  5.         With Range(xR, xH)
  6.               .Borders.Weight = 4
  7.               If .Count > 1 Then .Borders(12).Weight = 2
  8.         End With
  9.         Set xH = xR(2)
  10.     End If
  11. Next
½Æ»s¥N½X

TOP

Sub test()
Dim xR As Range, xH As Range
For Each xR In [H2:H19]
¡@¡@If xH Is Nothing Then xR = Split(Replace(xR, "-", "+", , 2), "+")(2): Set xH = xR
¡@¡@If xR(2) <> "" Then xR(2) = Split(Replace(xR(2), "-", "+", , 2), "+")(2)
¡@¡@If xR(2) <> xR Then
¡@¡@¡@¡@With Range(xR, xH)
¡@¡@¡@¡@¡@¡@¡@.Borders.Weight = 3
¡@¡@¡@¡@¡@¡@¡@If .Count > 1 Then .Borders(12).Weight = 2
¡@¡@¡@¡@End With
¡@¡@¡@¡@Set xH = xR(2)
¡@¡@End If
Next
End Sub
¡@
¡@

TOP

¦^´_ 8# Kubi


    ·PÁ¤j¤jªº´£¨Ñ !!

TOP

¦^´_  v03586
Hsieh µoªí©ó 2017-8-2 14:53



    ·PÁªO¤jªº´£¨Ñ¥t¤@ºØ¤è¦¡, ¹ï©óµe½uªº¤è¦¡, ¤S¾Ç¨ì¤@©ÛªO¤jªº¤è¦¡¼¶¼g

TOP

¦^´_ 7# GBKEE


    ·PÁªO¤jªº¨ó§U
  ²Ä¤E¦æ³o¤@¬q
  1. If UBound(sp) >= 2 Then
½Æ»s¥N½X
§ï¦¨³o¤@¬q´N¥i¥H§¹¦¨¤F !!! ¦A¦¸·PÁÂ~~

TOP

  1. Sub ex()
  2. Dim A As Range
  3. Set d = CreateObject("Scripting.Dictionary")
  4. For Each A In Range("H2:H15")
  5.   st = Split(Application.WorksheetFunction.Substitute(A, "-", Chr(10), 2), Chr(10))(1)
  6.   A.Offset(, 1) = st '¼g¤J
  7.   If IsEmpty(d(st)) Then '¦P¤å¦rÀx¦s®æ½d³ò¼È¦s
  8.     Set d(st) = A.Offset(, 1)
  9.     Else
  10.     Set d(st) = Union(d(st), A.Offset(, 1))
  11.   End If
  12. Next
  13. For Each ky In d.keys
  14. For i = 7 To 12
  15. With d(ky).Borders(i) 'µe®Ø½u
  16.         .LineStyle = xlContinuous
  17.         .ColorIndex = 0
  18.         .TintAndShade = 0
  19.         .Weight = IIf(i > 10, xlThin, xlMedium)
  20. End With
  21. Next
  22. Next
  23. End Sub
½Æ»s¥N½X
¦^´_ 6# v03586
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

TT = "09-SAF5-1111K-QQP"
TT = Split(Replace(TT, "-", "+", , 2), "+")(2)
MsgBox TT

TT = "09-C231-100WK"
TT = Split(Replace(TT, "-", "+", , 2), "+")(2)
MsgBox TT

TOP

¦^´_ 6# v03586
¥tºØ¸Ñªk¡A½Ð°Ñ¦Ò¡C
TEST-1.rar (22.02 KB)

TOP

¦^´_ 6# v03586

­×§ï¤F, ¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub Ex()
  3.     Dim E As Range, sp As Variant, i As Integer
  4.     With Range("h2").CurrentRegion
  5.     'Range.CurrentRegion ÄÝ©Ê ¶Ç¦^ Range ª«¥ó¡A¸Óª«¥ó¥Nªí¥Ø«eªº°Ï°ì¡C¥Ø«e°Ï°ì¬O«ü¥H¥ô·NªÅ¥Õ¦C¤ÎªÅ¥ÕÄ檺²Õ¦X¬°Ãä¬Éªº½d³ò¡C°ßŪªº¡C
  6.         For Each E In .Cells
  7.            sp = Split(E.Value, "-")
  8.            'Split ¨ç¼Æ ¶Ç¦^¤@­Ó³¯¦C¯Á¤Þ±q¹s¶}©lªº¤@ºû°}¦C , ¥¦¥]§t«ü©w¼Æ¥Øªº¤l¦r¦ê
  9.             If UBound(sp) > 2 Then   ' ³W«h, ¦³²Ä¤G­Ó¡y-¡z,¤~³B¸Ì
  10.                 For i = 0 To IIf(UBound(sp) > 2, UBound(sp) - 2, 1)
  11.                     E = Replace(E, sp(i) & "-", "")
  12.                 'Replace ¨ç¼Æ ¶Ç¦^¤@­Ó¦r¦ê , ¸Ó¦r¦ê¤¤«ü©wªº¤l¦r¦ê¤w³Q¨ú¥N¦¨¥t¤@¤l¦r¦ê, ¨Ã¥B¨ú¥Nµo¥Íªº¦¸¼Æ¤]¬O«ü©wªº
  13.                 Next
  14.             End If
  15.         Next
  16.         .BorderAround LineStyle:=xlContinuous, Weight:=xlMedium, ColorIndex:=xlAutomatic
  17.         For Each E In .Cells
  18.              With E.Borders(9)  'xlInsideVertical
  19.                 .LineStyle = xlContinuous
  20.                 .ColorIndex = xlAutomatic
  21.                 .TintAndShade = 0
  22.                 .Weight = IIf(E.Offset(1) <> E, xlThick, xlMedium)
  23.             End With
  24.         Next
  25.     End With
  26. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ v03586 ©ó 2017-7-29 12:56 ½s¿è

¦^´_ 5# GBKEE

   ¦p¹Ï¤ù»¡©ú , °ß¤@§äªº¨ì¤£Åܪº³W«h, ´N¬O±q¥ªÃ䩹¥kºâ¨â­Ó¡y-¡z ¤£«O¯d
    ¦pªG±q¥kÃäºâ, ¦³ªº·|¦³¥½½XQQP µ¥¦r½X
    Q2.png

     ¦³ªº¦r¦ê·|¦³¤T­Ó¡y-¡z  e.g.
     XX-XXXX-XXXX-QQP
     ¦³ªº¦r¦ê¥u¦³¨â­Ó¡y-¡z e.g.
    XX-XXXX-XXXX
    ­n«O¯dªº ¨Ì´`¦³®Ä³W«ß³W«h, ±q¥ªÃ䩹¥kºâ2­Ó¡y-¡z


TEST.rar (16.76 KB)

TOP

        ÀR«ä¦Û¦b : ¤H¥Í¤£¤@©w²y²y¬O¦n²y¡A¦ý¬O¦³¾ú½mªº±j¥´ªÌ¡AÀH®É³£¥i¥H´§´Î¡C
ªð¦^¦Cªí ¤W¤@¥DÃD