- ©«¤l
- 63
- ¥DÃD
- 32
- ºëµØ
- 0
- ¿n¤À
- 125
- ÂI¦W
- 0
- §@·~¨t²Î
- WIn10
- ³nÅ骩¥»
- OFFICE2013
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2018-7-19
- ³Ì«áµn¿ý
- 2022-8-11
|
[µo°Ý] ¨âÓ±ø¥ó¼Æ¶q¤À©î¤Î¹j¦æ¡C
¥»©«³Ì«á¥Ñ stephenlee ©ó 2019-12-28 10:19 ½s¿è
¤j®a¦n,§Ú¦³¤@Ó¤u§@ªí,¬On«ö¼Æ¶qªº¤j¤p¨Ó¤À¹j¦C¼Æ¤Î¼Æ¶q¡C
¥H¤U¹Ï¬°¨Ò,§Ú»Ýn¥HMÄ檺¤À©î¼Æ¶q©M¦C¼Æ¡C
¥Ø«e¤w¦³VBAªº¥N½X¡C
Private Sub CommandButton1_Click()
On Error Resume Next
Dim X As Long
Dim Y As Long
Dim Z As Long
Dim K As Long
Dim N As Long
'----------------------------------------
Dim ¨Ó·½¤u§@ªí As Worksheet
Set ¨Ó·½¤u§@ªí = ActiveSheet
'----------------------------------------
Dim ·s¼W¤u§@ªí As Worksheet
Set ·s¼W¤u§@ªí = Worksheets.Add(Worksheets(1))
·s¼W¤u§@ªí.Rows(1).Value = ¨Ó·½¤u§@ªí.Rows(1)
·s¼W¤u§@ªí.Cells(1, 19).Value = "´«¶"
'----------------------------------------
Dim °Ó¼Æ As Long
Dim ¾l¼Æ As Long
Dim ªÅ¦C As Long
N = 1
For X = 2 To ¨Ó·½¤u§@ªí.Cells(Rows.Count, 13).End(xlUp).Row
°Ó¼Æ = ¨Ó·½¤u§@ªí.Cells(X, 13).Value \ 3000
¾l¼Æ = ¨Ó·½¤u§@ªí.Cells(X, 13).Value Mod 3000
Select Case °Ó¼Æ
Case 0
°Ó¼Æ = 1
Case Else
Select Case ¾l¼Æ
Case Is < 100
'°Ó¼Æ = °Ó¼Æ
Case Else
°Ó¼Æ = °Ó¼Æ + 1
End Select
End Select
'----------------------------------------
For Z = 1 To °Ó¼Æ
N = N + 1
For Y = 1 To 19
Select Case Y
Case 1 To 13, 17, 18
·s¼W¤u§@ªí.Cells(N, Y) = ¨Ó·½¤u§@ªí.Cells(X, Y)
Case 14
·s¼W¤u§@ªí.Cells(N, Y) = 3000 * (Z - 1) + 1
Case 15
If Z = °Ó¼Æ Then
·s¼W¤u§@ªí.Cells(N, Y).Value = ¨Ó·½¤u§@ªí.Cells(X, Y).Value
Else
·s¼W¤u§@ªí.Cells(N, Y).Value = 3000 * Z
End If
Case 16
If Z = °Ó¼Æ Then
·s¼W¤u§@ªí.Cells(N, Y).Value = ¨Ó·½¤u§@ªí.Cells(X, Y).Value - 3000 * (Z - 1)
Else
·s¼W¤u§@ªí.Cells(N, Y).Value = 3000
End If
Case 19
If Not ·s¼W¤u§@ªí.Cells(N, 17).Value = ·s¼W¤u§@ªí.Cells(N - 1, 17).Value And N > 2 Then
·s¼W¤u§@ªí.Cells(N, Y).Value = "¤À¶²Å¸¹"
ªÅ¦C = (4 - (N - 2) Mod 4) Mod 4
If ªÅ¦C > 0 Then
For K = 1 To ªÅ¦C
·s¼W¤u§@ªí.Rows(N).Insert
N = N + 1
Next K
End If
End If
End Select
Next Y
Next Z
Next X
'----------------------------------------
·s¼W¤u§@ªí.UsedRange.Columns.AutoFit
·s¼W¤u§@ªí.Cells(2, 1).Activate
ActiveWindow.FreezePanes = True
End Sub
¥HMÄ欰¨Ò
§Ún¥H3000¤ºªº¼Æ¶q©MQÄæn°µ¤À©î©M¹j¦æ,¦ý¦pªG¬O3100¤ºªº¸Ü,¤]¬O¥i¥Hªº¡C¦P®É¹j¦æn¸òQªºÄæ¦ì¦WºÙ°µ4¿¼Æªº¹j¦æ¡C(n¥Î·s¤u§@ªí°µ¥Xµ²ªG)
MÄæ¬O§@¼Æ¶q°Ñ¦Ò°£3100,¤§«á°µ§¹¦A°µ¹j¦æ¬O4¿®t¡C
¦p¹Ï2
¦pªG¬O3100¤ºªº´N¤£¥Î©î¼Æ,¦ý¦]¬°ITEM¦WºÙ»P¨ä¥Lªº¤£¤@¼Ë,©Ò¥H³£n¹j¦æ¡C
²{®Én¨D¦pªG§Ún¦bNÄæ«e¥[¦h¤@Äæ,±N¥t¥~¤@ÓÄæ¦ì¦WºÙ·s¼W¤W¥h
«öcode ªº¸ê®Æ¨Ó°µ¼Æ¶q©î¼ÆÀ³¸Ó¦p¦ó°µ¡C
code01=3000 3100¤º
code02=4000 4100¤º
code03=5000 5100¤º
code04=6000 6100¤º |
|