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

Hi,

Cell a1 of Sheet3 has the value : Worksheets("Parameters").Range("d4")

I want to assing this value to a range variable named rsprange.

I am using the statement:
Set rsprange = ThisWorkbook.Worksheets("Sheet3").Range("a1").Valu e

I am getting error message 424: Object Required.

Please help. I have the feeling this is something elementary that I am
not able to trouble-shoot.

Thanks in advance

Regards,
Raj

PS: I had posted this earlier today under the subject : Setting range
using vlookup. I am restating the problem after stripping extraneous
matter.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Assigning cell value to range variable

You're going to have to parse the contents of that cell to extract the worksheet
name and the address.

After you do that, you can use:

dim wksName as string
dim RngAddr as string
....some routine to parse those strings
set rsprange = thisworkbook.worksheets(wksname).range(rngaddr)

===
If I were you, I'd use two cells--one for the worksheet name and one for the
address of the cell.

with thisworkbook.worksheets("sheet3")
set rsprange = thisworkbook.worksheets(.range("b1").value) _
.range(.range("C1").value)
end with

Depending on what the name of that sheet and the address, it could make life
lots easier.


Raj wrote:

Hi,

Cell a1 of Sheet3 has the value : Worksheets("Parameters").Range("d4")

I want to assing this value to a range variable named rsprange.

I am using the statement:
Set rsprange = ThisWorkbook.Worksheets("Sheet3").Range("a1").Valu e

I am getting error message 424: Object Required.

Please help. I have the feeling this is something elementary that I am
not able to trouble-shoot.

Thanks in advance

Regards,
Raj

PS: I had posted this earlier today under the subject : Setting range
using vlookup. I am restating the problem after stripping extraneous
matter.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 150
Default Assigning cell value to range variable

Dave,

Exactly the pointers I was looking for.

I have adopted the "If I were you" approach.

Thanks, once again.

Regards,
Raj

Dave Peterson wrote:

You're going to have to parse the contents of that cell to extract the worksheet
name and the address.

After you do that, you can use:

dim wksName as string
dim RngAddr as string
...some routine to parse those strings
set rsprange = thisworkbook.worksheets(wksname).range(rngaddr)

===
If I were you, I'd use two cells--one for the worksheet name and one for the
address of the cell.

with thisworkbook.worksheets("sheet3")
set rsprange = thisworkbook.worksheets(.range("b1").value) _
.range(.range("C1").value)
end with

Depending on what the name of that sheet and the address, it could make life
lots easier.


Raj wrote:

Hi,

Cell a1 of Sheet3 has the value : Worksheets("Parameters").Range("d4")

I want to assing this value to a range variable named rsprange.

I am using the statement:
Set rsprange = ThisWorkbook.Worksheets("Sheet3").Range("a1").Valu e

I am getting error message 424: Object Required.

Please help. I have the feeling this is something elementary that I am
not able to trouble-shoot.

Thanks in advance

Regards,
Raj

PS: I had posted this earlier today under the subject : Setting range
using vlookup. I am restating the problem after stripping extraneous
matter.


--

Dave Peterson

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
Assigning a variable Zack Excel Worksheet Functions 3 December 11th 08 07:00 PM
Assigning Variable Range JMay Excel Discussion (Misc queries) 1 July 7th 07 04:52 PM
assigning a letter in a cell from a range of numbers in another ce dba Excel Programming 2 May 23rd 07 04:43 PM
Assigning a variable a value from a Cell in VBA [email protected] Excel Programming 3 February 15th 06 06:26 PM
Assigning a cell the value of a cell in a range chyde2003 Excel Worksheet Functions 1 September 30th 05 08:26 PM


All times are GMT +1. The time now is 07:28 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"