Macro to run if multiple cells are blank

imcfcl

New Member
Joined
Sep 23, 2011
Messages
18
:confused:Hi there,

Hope all is well, I'm somewhere competent with normal excel and can use forumlae to get the result but I have pretty much zero vba knowledge. the strictly basic skills that I own have been learnt by modifying other peoples codes from this and other forums - thanks for the help over the times.

I have 2 Macro's, and i need to pick the right macro depending on wether four cell on the active sheet are blank.

C13 and C52 will have text, where as B37 and B76 will have a date. If all four cells are not blank, then I need Macro 2 to run. However if C52 and B76 are blank, but C13 and B37 are not, then I need Macro1 to run.

As an ideal, I'd also like a message box saying "no need to format sheet", if C13 is not blank but the others are (C13 will never ever be blank!)

I'm failing big time and would appreciate the help on the below code (although it is no doubt miles off).

Thanks in advance.


Sub AddSheetFormatChange()

If Range("C13") And Range("B37") And Range("C52") And Range("B76") <> "" Then
Application.Run "SecondAddNewSheets"
ElseIf Range("C13") And Range("B37") <> "" Then
Application.Run "FirstAddNewSheets"
Else: MsgBox "God Knows what has happened - Ask Simon :)"
End If
End Sub
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Maybe

Code:
Sub AddSheetFormatChange()
If Range("C13").Value <> "" And Range("B37").Value <> "" And Range("C52").Value <> "" And Range("B76").Value <> "" Then
    Application.Run "SecondAddNewSheets"
ElseIf Range("C13").Value <> "" And Range("B37").Value <> "" Then
    Application.Run "FirstAddNewSheets"
Else
    MsgBox "God Knows what has happened - Ask Simon "
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,550
Messages
6,179,462
Members
452,915
Latest member
hannnahheileen

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