|
作業列とオートフィルターを使うコードです。エラーへの対処はしていません。
Sub Get_WDay()
Dim SDy As Date, EDy As Date
Dim MyR As Range
Dim Wdy As String
SDy = DateSerial(Range("A1").Value, Range("A2").Value, 1)
EDy = DateAdd("m", 1, SDy)
Wdy = Range("A3").Text
Range("A4:A10").Clear
Range("IV1").Value = "曜日"
With Range("IU2")
.Value = SDy
.AutoFill .Resize(EDy - SDy), xlFillDays
Set MyR = Range(.Cells(1), .End(xlDown))
End With
MyR.Offset(, 1).Formula = "=TEXT($IU1,""aaa"")"
Range("IV1", Range("IV65536").End(xlUp)).AutoFilter 1, Wdy
MyR.SpecialCells(12).Copy Range("A4")
ActiveSheet.AutoFilterMode = False
Range("IU:IV").Clear: Set MyR = Nothing
End Sub
|
|