Computing.Net > Forums > Programming > Excel VBA troubleshooting

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Excel VBA troubleshooting

Reply to Message Icon

Name: razdamn
Date: September 16, 2002 at 07:36:35 Pacific
OS: Win 2000
CPU/Ram: 256
Comment:

hi

i am trying to write a code that differentiates between a 0 and a blankcell in an excel sheet.

the code :

Public Sub test()

If ActiveCell = "" Then MsgBox (" its blank ")
If ActiveCell = 0 Then MsgBox (" its zero")

End Sub

gives me both the prompts if the activecell is blank. i tried giving an = 0 and NOT Blank, but it doesnt work.

please advise.

thanks
raz



Sponsored Link
Ads by Google

Response Number 1
Name: dtech10
Date: September 16, 2002 at 14:06:11 Pacific
Reply:

Hi Razdamn
You might be able to use expressions like:

if IsBlank(ActiveCell)
if IsNumber(ActiveCell) AND ActiveCell=0

Hope this helps


0

Response Number 2
Name: A Certain TH
Date: September 17, 2002 at 08:11:35 Pacific
Reply:

Just append the activecell object with ".text":


Sub tester()
If ActiveCell.Text = "" Then MsgBox (" its blank ")
If ActiveCell.Text = "0" Then MsgBox (" its zero")

End Sub

Cheers
Tom


0

Response Number 3
Name: razdamn
Date: September 17, 2002 at 11:03:09 Pacific
Reply:

thanks A-Certain-Th, it works.



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


XML and DTS Interaction (... How to hijack INT 13h in ...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Excel VBA troubleshooting

Excel VBA Problem saving file www.computing.net/answers/programming/excel-vba-problem-saving-file-/14722.html

excel vba macro assistance www.computing.net/answers/programming/excel-vba-macro-assistance/10837.html

Excel-VBA problem www.computing.net/answers/programming/excelvba-problem/3695.html