ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   additional cell address help (https://www.excelbanter.com/excel-programming/310304-additional-cell-address-help.html)

scrabtree[_2_]

additional cell address help
 
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

Jan Karel Pieterse

additional cell address help
 
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


Don Guillett[_4_]

additional cell address help
 
why not just use

application.goto sheets("Sheet1").Range("A1")

--
Don Guillett
SalesAid Software

"scrabtree" wrote in message
...
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




Don Guillett[_4_]

additional cell address help
 
disregard my last post. Helps to read it all.

--
Don Guillett
SalesAid Software

"scrabtree" wrote in message
...
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





All times are GMT +1. The time now is 11:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com