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

[µo°Ý] ±N¸ê®Æ¼g¶i©T©wformatÄæ¦ì¤¤

[µo°Ý] ±N¸ê®Æ¼g¶i©T©wformatÄæ¦ì¤¤

¦U¦ì¤j¤j,³Â·Ð´£¨Ñ·N¨£

­n±N­ì©lªº¸ê®Æ¼g¶i©T©wformat(¦pªþ¥ó)
¦]¬°¦U®a«È¤á,device¹ïÀ³¨ìªºType¦³5ºØ
­Y¬O¨S¦³¸ÓºØÃþªº¼Æ¾Ú,«h¸ÓºØtype«h¤£·|Åã¬O¦b­ì©l¸ê®Æ
¦ý³Ì«á­n¼gºÉªº¸ê®Æªí¤¤©Ò§e²{¥X¨Óªºformat¤´Â­n¦³¸ÓÄæ¦ì
¦pªþ¥ó, ½Ð°Ý­n±q¦ó¼g°_????³Â·Ð´£¨Ñ·N¨£µ¹·s¤â,ÁÂÁÂÁÂÁÂ

»¡©ú¦pªþ¥ó©Î¤U­±³sµ²
https://www.dropbox.com/s/0ciopmd8k8pg9tn/Book9.xls

Book9.rar (17.48 KB)

»¡©ú

POP

¦^´_ 1# smartpearl
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub Ex()
  3.     Dim ­ì©lªº¸ê®Æ As Range, xType(), AR(1 To 2)
  4.     Dim ¸ê®Æªí As Worksheet, I As Integer, ii As Integer, R As Integer
  5.     xType = Array("Actual", "A_REAL", "Plan", "ALLOCATE", "Non_Plan")  '5ºØ Type
  6.     Set ­ì©lªº¸ê®Æ = Sheets("SHEET1").Range("a1").CurrentRegion
  7.     Set ¸ê®Æªí = Sheets("SHEET2")
  8.     ¸ê®Æªí.Cells.Clear
  9.     '*********************************************************************
  10.     '­ì©lªº¸ê®Æ©ó¤u§@ªí, A1¶}©l©ñ¸m
  11.     'ª`·N :  ­ì©lªº¸ê®Æ,CRP(Føó)ªº²Ä1­Ó¦³­È: ¸É¤W¨ä¥L¦ì¸mªº­È,¨Ï¥Î³o¦æµ{¦¡½X
  12.     ­ì©lªº¸ê®Æ.Columns(6).SpecialCells(xlCellTypeBlanks).Value = "=R[-1]C"
  13.     '*********************************************************************
  14.     I = 1
  15.     Do
  16.         With ­ì©lªº¸ê®Æ
  17.             R = ¸ê®Æªí.Cells(¸ê®Æªí.Rows.Count, 1).End(xlUp).Row
  18.             If I >= 2 Then
  19.                 For ii = 0 To UBound(xType)
  20.                     R = R + 1
  21.                     With .Rows(I)
  22.                         AR(1) = Array(.Cells(2), .Cells(7), .Cells(4), .Cells(5), .Cells(6), .Cells(8))
  23.                                       'CUSTOMER    TESTER     DEVICE    DEVICE_GRP   CRP         TIME
  24.                         ¸ê®Æªí.Cells(R, 1).Resize(1, 6) = AR(1)
  25.                     If .Cells(9) = xType(ii) Then
  26.                         AR(2) = Application.Transpose(Application.Transpose(.Cells(9).Resize(, .Columns.Count - 8)))
  27.                         ¸ê®Æªí.Cells(R, 7).Resize(1, UBound(AR(2))) = AR(2)
  28.                         With ­ì©lªº¸ê®Æ.Rows(I + 1)
  29.                             '¤ñ¹ï¤W¤UÄ檺¸ê®Æ
  30.                             If Join(Array(.Cells(0, 2), .Cells(0, 7), .Cells(0, 4), .Cells(0, 5), .Cells(0, 6)), ",") = Join(Array(.Cells(2), .Cells(7), .Cells(4), .Cells(5), .Cells(6)), ",") Then
  31.                                I = I + 1   '¤ñ¹ï¤W¤UÄ檺¸ê®Æ¬Û¦P
  32.                             End If
  33.                         End With
  34.                     Else
  35.                          ¸ê®Æªí.Cells(R, 7) = xType(ii)
  36.                     End If
  37.                     End With
  38.                 Next
  39.             Else
  40.                 With .Rows(1)
  41.                     ' Array(.Cells(2), .Cells(7), .Cells(4), .Cells(5), .Cells(6), .Cells(8), .Cells(9))
  42.                             'CUSTOMER   TESTER      DEVICE   DEVICE_GRP    CRP        TIME       TYPE
  43.                     ¸ê®Æªí.Cells(R, 1).Resize(1, 7) = Array(.Cells(2), .Cells(7), .Cells(4), .Cells(5), .Cells(6), .Cells(8), .Cells(9))
  44.                     AR(1) = .Range(.Cells(10), .Cells(.Columns.Count))
  45.                      With ¸ê®Æªí.[a1].End(xlToRight).Offset(, 1).Resize(1, UBound(AR(1), 2))
  46.                         .Value = AR(1)
  47.                         .NumberFormatLocal = "m/d;@"
  48.                        
  49.                       End With
  50.                     
  51.                 End With
  52.             End If
  53.             I = I + 1
  54.         End With
  55.     Loop Until I > ­ì©lªº¸ê®Æ.Rows.Count
  56.     With ¸ê®Æªí.Range("A1").CurrentRegion
  57.         .HorizontalAlignment = xlCenter
  58.         .VerticalAlignment = xlCenter
  59.         .WrapText = False
  60.         For I = 2 To .Rows.Count Step 5
  61.             .Rows(I & ":" & I + 4).BorderAround 1
  62.             Application.DisplayAlerts = False
  63.             For ii = 1 To 5
  64.                 .Columns(ii).Range("A" & I & ":A" & I + 4).MergeCells = True
  65.             Next
  66.             Application.DisplayAlerts = True
  67.         Next
  68.     End With
  69. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : °µ¸Ó°µªº¨Æ¬O´¼¼z¡A°µ¤£¸Ó°µªº¨Æ¬O·Mè¡C
ªð¦^¦Cªí ¤W¤@¥DÃD