![]() |
Variable produces a complie error
I have a macro that takes a variable value from a cell on
a specific sheet. This worked just fine the first three months we ran the thing and now I get "Compile error: Object required". Am I missing something? I can't figure out what's wrong. Dim myMonth as Integer Set myMonth = Worksheets ("BANNER DATA").Range ("A2") The cell has the correct number in it. Thanks for any help you can offer. |
Variable produces a complie error
"Set" is used in assigning an object to an object variable. You're
assigning the default range property (.Value) to an integer variable. To assign a value, you can use the optional Let (or, like 99.99% of users, leave it out). Dim myMonth As Integer Let myMonth = Worksheets("BANNER DATA").Range("A2").Value or Dim myMonth As Integer myMonth = Worksheets("BANNER DATA").Range("A2").Value In article , "Btinker" wrote: I have a macro that takes a variable value from a cell on a specific sheet. This worked just fine the first three months we ran the thing and now I get "Compile error: Object required". Am I missing something? I can't figure out what's wrong. Dim myMonth as Integer Set myMonth = Worksheets ("BANNER DATA").Range ("A2") The cell has the correct number in it. Thanks for any help you can offer. |
All times are GMT +1. The time now is 06:14 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com