Moonbeam111
Board Regular
- Joined
- Sep 24, 2018
- Messages
- 88
- Office Version
- 365
- 2010
I have two questions. I hope its not against the message board rules to ask 2 questions in 1 thread but I figure why not.
The first is: I am not sure why I'm getting a type mismatch error here. I know I could make this code prettier somehow by using a "for" statment to check each cell but I'm just used to the "if" statements.
The second is: How do check if a macro button has been called? For example, I call button4_click and in another macro I would like to know if button4_click has been called and if so 'then do something else. I've searched around but couldn't find a clear answer for myself.
The first is: I am not sure why I'm getting a type mismatch error here. I know I could make this code prettier somehow by using a "for" statment to check each cell but I'm just used to the "if" statements.
VBA Code:
If Range("D141") = "example message" And Range("D151") = "example message" Or IsEmpty(Range("C143")) And Range("D161") = "example message" Or IsEmpty(Range("D153")) And Range("D171") = "example message" Or IsEmpty(Range("C163")) And Range("D181") = "example message" Or IsEmpty(Range("C173")) And Range("D191") = "example message" Or IsEmpty(Range("C183) And Sheets("Sheet1").Range("G25") > Sheets("Sheet2").Range("E25") Then
'do something
The second is: How do check if a macro button has been called? For example, I call button4_click and in another macro I would like to know if button4_click has been called and if so 'then do something else. I've searched around but couldn't find a clear answer for myself.