ActiveCell = address

Maurizio

Well-known Member
Joined
Oct 15, 2002
Messages
682
Office Version
  1. 2007
Platform
  1. Windows
How can I write a formula that:
if activecell has address "C1" then...
Cells(550, 2).End(xlUp).Select
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Sheet Module code.
'Trigger if selected cell is "C1."
If Target = [C1] Then

MsgBox "Test Message!" '<== Put your code in place of this!

End If
End Sub

Hope this helps. JSW
 

Chas17

Well-known Member
Joined
Oct 16, 2002
Messages
657
This works, however, If you select a row by clicking on row #, say row 5, it will error.
Excell 97.
 

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539
This is a better macro:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myCell As Range
'Sheet Module code.
'Trigger if selected cell is "C1."
Set myCell = Range("C1")
If Target.Address = myCell.Address Then

MsgBox "Test Message! " '<== Put your code in place of this!

Else
Exit Sub
End If
End Sub
 

Forum statistics

Threads
1,143,915
Messages
5,721,512
Members
422,369
Latest member
redinator

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top