a macro that checks if there is a value in a cell

dj_dafad

New Member
Joined
Mar 24, 2002
Messages
6
I would like to create a macro which checks at the beginning if a certain cell has a value. if the cell has a value the macro carries on running as normal, if the cell is blank, a message comes up to tell the user that 'the data isn't verified....' or something like that. help! how do i do this?
thanx to anyone who can help me. chiao,
dj_dafad

p.s. is it something along the lines of this:

Dim wrong
If Range("d20") = 0 Then
wrong = MsgBox("you have not verified that all of the data entered is correct",
vbExclamation,"verify")
GoTo FINISH
End If
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hi. How about use "IsEmpty"?

If isempty(range("D20") then
msgbox "you have not....."
end if
 
Upvote 0
Hi there

Try changing it a bit to something like this (insert the macro code you want to run if D20 is not 0 where is says "rest of your macro" (without the quotes)


If Range("d20") = 0 Then
MsgBox "you have not verified that all of the data entered is correct", vbExclamation, "verify"
Exit Sub
Else
"rest of your macro"
End If
End Sub

regards
Derel
 
Upvote 0
Hello, friend.
Thank you for your amazing question. I think you are on the right track to solving your problem with the IF function. I am not familiar with the deep dark realms of the evil microsoft's Visual Basic.
If you wish to proceed and learn this foreign tounge, do so at your own risk. But be warned, demons lurk behind them AND THE MIGHTY VULCANS SHALL NOT SAVE YOU.

In the words of Captain Kurk of the starship enterprise, peace be with you, friend.
 
Upvote 0
hey, thanks for the help, it works.
M-Disley, I don't know what your on about, mayby you should lay off the star wars.
thaks again
dj_dafad
 
Upvote 0

Forum statistics

Threads
1,213,563
Messages
6,114,332
Members
448,566
Latest member
Nickdozaj

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