有book1,其中一列是旧书的名称,另一列是新书的名称(旧书需要重命名为新书) 发生错误:在第一个(第一个)行中找不到运行时错误“ 54”文件
Name OldName As NewName
代码:
Sub Êë()
Dim OldName, NewName
Dim book1 As Workbook
Dim t As Long, m As Long, n As Long
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Set book1 = Workbooks.Open("E:\Super M\Ïðîåêò ñòàâêè\Ïîèñê ðåøåíèÿ\Óñîâ
7\âñïîìîãàòåëüíûå ïðîãðàììû\Êíèãà â ëèñò\âèç.xlsx")
For t = 3 To 5
book1.Worksheets("îáù").Range("C" & t).Value = n
book1.Worksheets("îáù").Range("C" & t).Offset(0, 1).Value = m
OldName = "n": NewName = "m"
Name OldName As NewName
OldName = "E:\Super M\Ïðîåêò ñòàâêè\Ïîèñê ðåøåíèÿ\Óñîâ 7\âñïîìîãàòåëüíûå
ïðîãðàììû\Êíèãà â ëèñò\Îòáîðíûå óñëîâèÿ\Îòêóäà\n": NewName =
"E:\Super M\Ïðîåêò ñòàâêè\Ïîèñê ðåøåíèÿ\Óñîâ 7\âñïîìîãàòåëüíûå
ïðîãðàììû\Êíèãà â ëèñò\Îòáîðíûå óñëîâèÿ\Êóäà\m"
Name OldName As NewName
Next t
book1.Close
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
End Sub