Мне нужно, чтобы нижний код стал для l oop
Sub Macro1 ()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://address_foo/Machine_History.asp?SAR=VCL101" _
, Destination:=Range("$A$1"))
.Name = "Machine_History.asp?SAR=VCL101"
.WebFormatting = xlWebFormattingNone
.Refresh BackgroundQuery:=False
End With
ChDir "C:\Users\foo\Desktop"
ActiveWorkbook.SaveAs Filename:="C:\VCL101.csv", _
FileFormat:=xlCSVMSDOS, CreateBackup:=False
Selection.Delete Shift:=xlToLeft
Cells.Select
Selection.Delete Shift:=xlUp
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://address_foo/Machine_History.asp?SAR=VCL102" _
, Destination:=Range("$A$1"))
.Name = "Machine_History.asp?SAR=VCL102"
.WebFormatting = xlWebFormattingNone
.Refresh BackgroundQuery:=False
End With
ChDir "C:\Users\foo\Desktop"
ActiveWorkbook.SaveAs Filename:="C:\VCL102.csv", _
FileFormat:=xlCSVMSDOS, CreateBackup:=False
Selection.Delete Shift:=xlToLeft
Cells.Select
Selection.Delete Shift:=xlUp
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://address_foo/Machine_History.asp?SAR=VCL103" _
, Destination:=Range("$A$1"))
.Name = "Machine_History.asp?SAR=VCL103"
.WebFormatting = xlWebFormattingNone
.Refresh BackgroundQuery:=False
End With
ChDir "C:\Users\foo\Desktop"
ActiveWorkbook.SaveAs Filename:="C:\VCL103.csv", _
FileFormat:=xlCSVMSDOS, CreateBackup:=False
Selection.Delete Shift:=xlToLeft
Cells.Select
Selection.Delete Shift:=xlUp
End Sub
Вы видите, что VCL101 нужно go до VCL999 Но эти переменные в кавычках, я не могу просто дать им переменную, спасибо за помощь