additional cell address help

  • Thread starter Thread starter scrabtree
  • Start date Start date
S

scrabtree

The Sub DefineCell Address () returns the cell address but
it does not include which sheet the active cell is in?
How can I put the Sheet and Cell address in the reference
cell?

Public MyCellAddr As String
Sub DefineCellAddress()
MyCellAddr = ActiveCell.address
Worksheets("Sheet1").Range("A1").Value = MyCellAddr
End Sub

Sub GotoMyCellAaddress()
Range(MyCellAddr).Select
End Sub
 
Hi Scrabtree,
Public MyCellAddr As String
Sub DefineCellAddress()
MyCellAddr = ActiveCell.address
Worksheets("Sheet1").Range("A1").Value = MyCellAddr
End Sub

Sub GotoMyCellAaddress()
Range(MyCellAddr).Select
End Sub

MyCellAddr= "'" & Activecell.parent.name & "'!" & activecell.address

But that would cause the gotomycelladdress sub to fail. Maybe beter to
set an object to the cell:

Public MyCell As Range

Sub DefineCellAddress()
set MyCell = ActiveCell
Worksheets("Sheet1").Range("A1").Value = "'" &
activecell.parent.name & "'!" & Activecell.address
End Sub

Sub GotoMyCellAaddress()
Application.Goto MyCell
End Sub

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top