![]() |
|
#1
|
|||
|
|||
|
If a Command Button is activated to run a macro and if any of the rows 1 through 7 are active, do not run macro…..but show message box advising that this is the case. Message Box to have a button having caption “ok” which will return control back to user. If neither of the rows 1 through 7 are the Active Row, run the macro. |
|
#2
|
|||
|
|||
|
Give this a try...
Code:
Sub Button1_Click()
If activecell.Row > 7 Then
Call OtherMacro
ElseIf activecell.Row < 8 Then
MsgBox "Marcro cannot be run on a row between 1 and 7"
Exit Sub
End If
End Sub
|
|
#3
|
|||
|
|||
|
jeffreybrown
Works like a charm. Thank you very much. Would you have time to look at another "if then else" issue? If "A37" has more than one letter then "C15" = " A37" and "C16"="A38" and Otherwise "C15" =" " and "C16" = "A37" Thanks again for your solution to my inquiry. |
|
#4
|
|||
|
|||
|
Could be as simple as...
Code:
Sub Look_At_A37()
If Len(Range("A37")) > 1 Then
Range("C15").Value = Range("A37").Value
Range("C16").Value = Range("A38").Value
End If
End Sub
|
|
#5
|
|||
|
|||
|
jeffreybrown
Thanks a million. The "len" part is what I wasn't getting. |
|
#6
|
|||
|
|||
|
Awesome. You're welcome and glad you now have a workable solution.
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Looking for advise on the complex mixing of functions | mcd.sg.11 | Excel | 2 | 05-31-2016 08:02 AM |
Using IF statement to flag a required action
|
stuwoolf | Excel | 4 | 01-28-2015 12:27 PM |
Message replys are shown at the bottom of the message, how can I get them to the top
|
Gardy | Outlook | 3 | 05-23-2012 01:20 AM |
| How to link an action on one slide on a powerpoint with the same action on another | slevinmj | PowerPoint | 0 | 02-24-2011 05:38 AM |
| Sorting columns in Excel - please advise | Jonre | Excel | 2 | 08-21-2009 02:38 AM |