ActiveCell = address

Maurizio

Well-known Member
Joined
Oct 15, 2002
Messages
687
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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
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
 
Upvote 0
This works, however, If you select a row by clicking on row #, say row 5, it will error.
Excell 97.
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,716
Members
448,985
Latest member
chocbudda

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
Back
Top