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? |
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? |
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? . |
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? . |
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? . . |
All times are GMT +1. The time now is 10:44 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com