I have 2 subs that I'd like to execute based on what cell is currently active in the worksheet. So for example, if one of the cells in range A1:D1 is active, upon pressing a button, sub1 will run, if one of the cells in range A5:D5 is currently active, upon pressing a button, sub2 will run.
How can this be coded?
Thank you.
Last edited by luv2glyd; 09-04-2010 at 11:52 AM.
You either quit or become really good at it. There are no other choices.
Sub Button1_Click() If Not Intersect(Range("A1"), ActiveCell) Is Nothing Then MsgBox "Sub 1" ElseIf Not Intersect(Range("A2"), ActiveCell) Is Nothing Then MsgBox "Sub 2" Else MsgBox "Do nothing" End If End Sub
Perfect; thank you!
You either quit or become really good at it. There are no other choices.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks