Macro: If a1 is blank, run macro X, else do nothing

oliviar

Board Regular
Joined
Sep 12, 2010
Messages
184
I am trying to get my macro to do this on open. Check if a1 is empty, if its empty run another macro (which is an input box to put something IN a1), but if A1 has something in it, DO NOTHING.

I keep getting errors, saying I'm not formulating my if statements correctly. :confused:

This is what I have:
Code:
Private Sub Workbook_Open()
If Range("a1") = "" Then macrox
else do nothing
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.
try..

Code:
'Thisworkbook code
Private Sub Workbook_Open()
try1
End Sub
'standard module code
sub try1
If Range("a1").value = "" Then
macrox ' your macro
else 
exit sub 'do nothing
End If
end sub
 
Upvote 0
Pedie you are a legend, and your dog is adorable.
But why did it hate me the first time? I thought I did it right :'(
 
Upvote 0
Pedie you are a legend, and your dog is adorable.
But why did it hate me the first time? I thought I did it right :'(

Guys please help i dont fully understand what this sentence suppose to mean:biggrin:
'm english learner:ROFLMAO:
I can put in the inputbox but not sure what you want the input value to be like and wat u want to do with the value inputed so...
 
Upvote 0

Forum statistics

Threads
1,213,534
Messages
6,114,184
Members
448,554
Latest member
Gleisner2

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