Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default 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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2002 produces error in calculation. Wes at CCC Excel Discussion (Misc queries) 4 November 16th 07 08:54 PM
Refresh produces #N/A error RhysPieces Links and Linking in Excel 1 July 11th 07 07:42 PM
Refresh produces #N?A error RhysPieces Excel Discussion (Misc queries) 1 July 10th 07 09:16 AM
How to fix "complie error:procedures" in Excel? Cris Liu Excel Discussion (Misc queries) 4 June 27th 06 11:48 PM
CreateObject produces error Robert Chapman Excel Programming 0 August 15th 03 03:48 PM


All times are GMT +1. The time now is 03:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"