Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Setting range value to a variable

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?




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Setting range value to a variable

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



"Todd" wrote in message
...
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?






  #3   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 17
Default Setting range value to a variable

hey
just try making it this way

desc = Range("D9").Value

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

-----Original Message-----
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?




.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Setting range value to a variable

Todd,

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

-----Original Message-----
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?




.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Setting range value to a variable

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

-----Original Message-----
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?




.

.

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
Setting a string variable as the file name [email protected] Excel Discussion (Misc queries) 1 March 28th 07 11:10 PM
Setting up variable summary sheet. shakey1181 Excel Discussion (Misc queries) 4 August 18th 06 01:37 PM
Setting variable names in code Frank Kabel Excel Programming 0 May 20th 04 04:39 PM
Setting a variable print area cdb Excel Programming 4 May 20th 04 02:21 PM
Setting up a variable print range Gary[_5_] Excel Programming 5 July 31st 03 04:32 AM


All times are GMT +1. The time now is 08:54 PM.

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"