Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Pass a string to an address

In this snip I need to pass a range.address of a range to a string,
manipulate the strig and then pass it back to the range.address. the
first two steps are fine but I get an error "assignment to constant
not permited" when I try to pass the string back to the address.


Dim srcRngU as Range
Dim wrkAdd As String

srcRng is assigned to a range with removed code...

wrkAdd = srcRngU.Address
wrkAdd = Application.Substitute(wrkAdd, ",", "," & shtNm & "!")
wrkAdd = shtNm & "!" & wrkAdd
srcRngU.Address = wrkAdd <-------"assignment to constant not permited"
error here

This must be something simple!!!!! but I give up
help will be appreciated

Robert

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Pass a string to an address

You can't assign an address to a range, the range's address is an
inherent property.

Looks like you really want to reassign the srcRngU range object variable
to a new range on sheet shtNm. Perhaps something like:

Set srcRngU = Worksheets(shtNm).Range(srcRngU.Address)


In article .com,
"Robert H" wrote:

In this snip I need to pass a range.address of a range to a string,
manipulate the strig and then pass it back to the range.address. the
first two steps are fine but I get an error "assignment to constant
not permited" when I try to pass the string back to the address.


Dim srcRngU as Range
Dim wrkAdd As String

srcRng is assigned to a range with removed code...

wrkAdd = srcRngU.Address
wrkAdd = Application.Substitute(wrkAdd, ",", "," & shtNm & "!")
wrkAdd = shtNm & "!" & wrkAdd
srcRngU.Address = wrkAdd <-------"assignment to constant not permited"
error here

This must be something simple!!!!! but I give up
help will be appreciated

Robert

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Pass a string to an address

Thanks, for clarifying that to me. But,
Set srcRngU = Worksheets(shtNm).Range(srcRngU.Address)

doesn't do anything. All i can see that it would do is change the
value of srcRngU to be the same as it address string. I need to charge
the actual range of cells that the range refers to. If I read that
right your saying that cant be done. if that were the case then we
could not programaticaly create a range. Ow, my head hurts :)



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Pass a string to an address

I answered my question with this test:

Public Sub changerange()
Dim myStrg As String
Dim myrange As Range
myStrg = "A3"

Set myrange = Range("a1")
myrange.Select

Set myrange = Range("a2")
myrange.Select

Set myrange = Range(myStrg)
myrange.Select

End Sub

sometimes I have to go back to the basics, WAY back, that is

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
Pass Cell Address to OFFSET ExcelGuy555 Excel Worksheet Functions 3 August 18th 07 07:42 AM
How to pass address(es) as parameters Pat Excel Programming 12 May 22nd 06 03:15 AM
pass cell value as string to function fybar Excel Programming 2 November 3rd 05 04:37 AM
Pass string value to another form yangyh[_5_] Excel Programming 1 September 11th 05 10:01 AM
Pass string as Parameter in OpenText method No Name Excel Programming 0 January 8th 04 06:22 AM


All times are GMT +1. The time now is 03:07 AM.

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"