--ndn.diva--
New Member
- Joined
- Jun 23, 2008
- Messages
- 12
I'm writing a macro to retrieve data from an Excel add-in. It's only a few lines of code, and I've written it several times and it has worked perfectly. However, this time, I get an error message: Select Method of Range class failed.
The section of code that is causing the problem is:
If (Range("Month") = "9") Then
Sheets("Analysis May 08 NLD").Activate
Range("A2:B51").Select 'code that is causing the problem
Application.Run ("EssmenuRetrieve")
Sheets("Analysis May 08 LDD").Activate
Range("A2:B51").Select
Application.Run ("EssmenuRetrieve")
MsgBox ("Data Retrieved")
The value in the cell "Month" is 9, so that part of the code is working properly. I've tried changing the value in that cell to another number, and running the code, after changing the sheet name to the corresponding month, however, I got an error at the same point.
I've made sure that everything is typed in correctly (as i said, i've written this bit of code before).
Any suggestions?
Thanks!!
The section of code that is causing the problem is:
If (Range("Month") = "9") Then
Sheets("Analysis May 08 NLD").Activate
Range("A2:B51").Select 'code that is causing the problem
Application.Run ("EssmenuRetrieve")
Sheets("Analysis May 08 LDD").Activate
Range("A2:B51").Select
Application.Run ("EssmenuRetrieve")
MsgBox ("Data Retrieved")
The value in the cell "Month" is 9, so that part of the code is working properly. I've tried changing the value in that cell to another number, and running the code, after changing the sheet name to the corresponding month, however, I got an error at the same point.
I've made sure that everything is typed in correctly (as i said, i've written this bit of code before).
Any suggestions?
Thanks!!