|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 一掷乾坤 于 2023-4-13 15:54 编辑
求助,这个自动填充的代码为什么会报错,两段代码都没法运行。
Sub 填充工作日()
Range("A1").AutoFill Destination:=Range("A2:A30"), Type:=xlFillWeekdays
End Sub
Sub 填充工作日1()
Dim LasttimeRow As Integer, StarRow As Integer, EndRow As Integer
Dim fanwei As String, rng1 As Range, rng2 As Range
LasttimeRow = Range("A1048576").End(xlUp).Row
StarRow = LasttimeRow + 1
EndRow = StarRow + 19
fanwei = "A" & StarRow & ": A" & EndRow
Set rng1 = Range("A" & LasttimeRow)
Set rng2 = Range(fanwei)
MsgBox rng1.Address & rng2.Address
rng1.AutoFill Destination:=rng2, Type:=xlFillWeekdays
End Sub
|
|