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

[µo°Ý] Excel ³æÄæ¸ê®ÆÂà¦hÄæ

±z¦n¡A
§Ú¦³¤@­Ó"Àˮ֪O¸¹.xlsm"Åý¨Ï¥ÎªÌ©óA1.A2.A3.A4¤À§O¿é¤J¯S©w¸ê®Æ¡A¨C4µ§¸ê®Æ¬°¤@²Õ¡C

¥Ø«e§Ú©óF ...
pointchi µoªí©ó 2022-9-11 23:58


·s¼W¦p¤U¡A½Ð´ú¸Õ¬Ý¬Ý¡AÁÂÁÂ


Sub Step01()

M1 = Format(Now, "MM")
D1 = Format(Now, "DD")
H1 = Format(Now, "HH")
N1 = Format(Now, "NN")

    Columns("F:I").Select
    Selection.Copy
    Workbooks.Add
    Columns("A:A").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
        
Dim xR As Range, xU As Range
For Each xR In ActiveSheet.Range("C:C").SpecialCells(xlCellTypeConstants).Rows
    If Not IsError(Application.Match(0, xR, 0)) Then
        If xU Is Nothing Then Set xU = xR Else Set xU = Union(xR, xU)
     End If
Next
If Not xU Is Nothing Then xU.EntireRow.Delete


   
    Application.CutCopyMode = False
    ActiveWorkbook.SaveAs Filename:="C:\Users\Point\OneDrive\®à­±\" & M1 & D1 & "-" & H1 & N1 & ".xlsx"
End Sub

TOP

¦^´_ 3# pointchi

­É¥ÎAndy2483«e½åµ{¦¡½X¡A­×§ï¤@¤U¡A½Ð´ú¸Õ¬Ý¬Ý¡AÁÂÁÂ
Sub test()
Dim MDHN, i&, Arr, Brr, R&, C%
MDHN = Format(Now, "MMDD-HHNN")
Arr = Range([A1], Cells(Rows.Count, "A").End(3))
ReDim Brr(1 To UBound(Arr) / 4, 1 To 4)
For i = 1 To UBound(Arr)
    C = C + 1: Brr(R + 1, C) = Arr(i, 1)
    If C = 4 Then C = 0: R = R + 1

Next
Workbooks.Add
[A1].Resize(1, 4) = Array("®Æ¸¹", "¼Æ¶q", "ªO¸¹", "Àx¦ì")
[A2].Resize(UBound(Brr), 4) = Brr
[A:D].Columns.AutoFit
ActiveWorkbook.SaveAs Filename:="C:\Users\Point\OneDrive\®à­±\" & MDHN & ".xlsx"
End Sub

TOP

        ÀR«ä¦Û¦b : ¦³Ä@©ñ¦b¤ß¸Ì¡A¨S¦³¨­Åé¤O¦æ¡A¥¿¦p¯Ñ¥Ð¤£¼½ºØ¡A¬Ò¬OªÅ¹L¦]½t¡C
ªð¦^¦Cªí ¤W¤@¥DÃD