Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? . . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Setting a string variable as the file name | Excel Discussion (Misc queries) | |||
Setting up variable summary sheet. | Excel Discussion (Misc queries) | |||
Setting variable names in code | Excel Programming | |||
Setting a variable print area | Excel Programming | |||
Setting up a variable print range | Excel Programming |