help with finding out if a cell is empty

wking1976

New Member
Joined
Feb 20, 2002
Messages
29
ia am trying to run a macro from a command botton only if there is any data in cell a1
here is my code that does not work
Private Sub CommandButton1_Click()
Dim ianswer As Integer

If ("a1") Is Not Empty Then
Run ("UploadToDatabaseWT062v8_800")
ianswer = MsgBox("Upload OK", vbOKOnly)
Else
ianswer = MsgBox("There is no data to upload!", vbOKOnly)
End If
End Sub



any hints?
Thanks,
W.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Perhaps the following will work:

Private Sub CommandButton1_Click()
Dim ianswer As Integer

If range("a1")<> "" Then
Run ("UploadToDatabaseWT062v8_800")
ianswer = MsgBox("Upload OK", vbOKOnly)
Else
ianswer = MsgBox("There is no data to upload!", vbOKOnly)
End If
End Sub

Cheers, Nate
This message was edited by NateO on 2002-02-21 08:03
 
Upvote 0
Getting close,
Whether the cell is empty or not any code under this line

If range("a1") <> "" Then

runs
 
Upvote 0
That's my proposition. Getting close or hitting the nail on the head? Hopefully the latter.

Cheers,

Nate
 
Upvote 0
Nice! I think yours would too if you just inserted 'range' in front of your cell reference. Good hunting.

Cheers,
Nate
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,952
Members
448,535
Latest member
alrossman

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