Setting range value to a variable

  • Thread starter Thread starter Todd
  • Start date Start date
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?
 
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
 
hey
just try making it this way

desc = Range("D9").Value

just assigning the value to it. i think it should work
 
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

.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top