Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reporting Value of Cell

Status
Not open for further replies.
Joined
Mar 26, 2004
Messages
19
Location
GB
Hello,

I want to pick up a peace of text from a named range "Group_Reference", then drop it in another cell.
Instead the below code is reporting Group_Reference as text instead of the text entered in Group_Reference, any ideas.



Sub group_Reference()
Dim group_Reference As Range

Application.ScreenUpdating = False
Application.Run "Unlock_WorkshLS"
Sheets("WorkshLS.XLS").Select
Range("A600").Select
ActiveCell.FormulaR1C1 = "group_Reference"
Application.Run "Lock_WorkshLS"

Application.ScreenUpdating = True
End Sub
 
hi green,

This statement
[tt]
ActiveCell.FormulaR1C1 = "group_Reference"
[/tt]
assigns "group_Reference" to the VALUE of the cell.

If your intention is to NAME the RANGE reference "group_Reference" then
Code:
    ActiveWorkbook.Names.Add _
      Name:="group_Reference", _
      RefersTo:="='" & ActiveSheet.Name & "'!" & [A600].Address
:-)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at faq222-2244
 
Thanks for that, I have already named a cell group refence, this cell contains a variable string which I want to pick up and drop in cell A600.

I could do copy/paste but I would like to use this method.

any ideas?
 
Code:
ActiveCell.Value= Range("group_Reference").Value


Skip,

Want to get great answers to your Tek-Tips questions? Have a look at faq222-2244
 
You do NOT have to Select A600! Better not to -- faq707-4105 How Can I Make My Code Run Faster?
Code:
[A600].Value= Range("group_Reference").Value


Skip,

Want to get great answers to your Tek-Tips questions? Have a look at faq222-2244
 
Just to be pedantic (and make it shorter) - if we're using the evaluate method, it works on range names as well:

[A600]= [group_Reference]

Rgds, Geoff

Never test the depth of water with both feet

Help us to help you by reading FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top