Setting range value to a variable

T

Todd

Hi all,

I'm trying to set a range value to a variable with the
following code:

Dim desc As String
Set desc = Range("D9").Value

I keep getting an "Object Required" error and can't for
the life of me figure it out. Any suggestions?
 
C

Chip Pearson

Todd,

Get rid of the Set keyword. It is only used when assigning an
object to an object variable. Since you have declared desc as a
String, and you are using the Value property of the range, you
don't need and are not allowed to use Set.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
S

sam

hey
just try making it this way

desc = Range("D9").Value

just assigning the value to it. i think it should work
 
T

Todd

Well that was simple ;)

Thanks to you both
-----Original Message-----
hey
just try making it this way

desc = Range("D9").Value

just assigning the value to it. i think it should work

.
 
Top