D
Dave Peterson
Is it this line:
Windows("excel_sheet[1].xls").Activate
If yes, then you don't have a window by that name.
I'd go through the workbook collection (but you still have to spell the workbook
name correctly):
Workbooks("excel_sheet[1].xls").Activate
Those square brackets don't look legal to me.
If you didn't make a typing error, close your file.
Use windows explorer to change the name (use () instead of [])
Open your workbook
fix your code
and try again.
Windows("excel_sheet[1].xls").Activate
If yes, then you don't have a window by that name.
I'd go through the workbook collection (but you still have to spell the workbook
name correctly):
Workbooks("excel_sheet[1].xls").Activate
Those square brackets don't look legal to me.
If you didn't make a typing error, close your file.
Use windows explorer to change the name (use () instead of [])
Open your workbook
fix your code
and try again.
When you change subjects, you should start a new thread.
If you used the button from the Forms toolbar placed on aworksheet, just
rightclick on the button and choose assign macro.
- Show quoted text -...
read more »
Sorry for not starting the new thread.
I have assigned and recorded macro to button to refresh data. But i
get error "Subscript out of range" whenever i click the refresh
button. Below is the recorded macro.
Sub Button2_Click()
Columns("A:Q").Select
Selection.ClearContents
Windows("excel_sheet[1].xls").Activate
Range("A1:Q34000").Select
Selection.Copy
Windows("Sheet1.xls").Activate
Range("A4").Select
ActiveSheet.Paste
Range("A4").Select
Application.CutCopyMode = False
End Sub