Hello,
New to the forum and to VBA in general. Have a question about how to have a cell have a variable date that then changes the macro run depending on that date? For example....lets say the date is in B2 and I am pulling information from a website that is date dependent, then how do I do that macro. I will paste the code I have below and hopefully someone can help me in deciding what is wrong with it. When I try and run it it says Variable not found on "B2". Not sure if there are other problems in the code but I do know that if I put in a actual date where I have the text (B2, etc) field then the code works. Any help would be much appreciated!
Sub Button1_Click()
' Losses Macro
' MLC for whatever day
'
Workbooks.Open Filename:= _
"https://www.midwestiso.org/Library/Repository/Market%20Reports/" & Text(B2, "yyyymmdd") & "_da_lmp.csv"
ActiveWindow.Visible = False
Windows(" & Text(B2, "yyyymmdd") & "_da_lmp.csv").Visible = True
Rows("3532:5294").Select
Selection.Copy
Windows("Monthly MLC avg.xlsm").Activate
ActiveWindow.WindowState = xlNormal
ActiveWindow.WindowState = xlNormal
ActiveWindow.WindowState = xlMaximized
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AD17").Select
End Sub
Bookmarks