MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Simple VBA question

Posted by Rob on July 09, 2001 7:11 PM

I have the following print button code:

Sub Credit_Discl_Print()

If Sheet16.Range("F2") = "" Then
With Sheet16.Range("A27:Z142").PrintOut
End With
With Sheet16.Range("A27:Z257").PrintOut
End With

End If
End Sub

I would like to know if there is a way to test the VALUE of F2 to see if it is blank. Right now, I have a formula in it, and it is printing the first statement eventhough the value of F2 is blank. How do I fix this?


Posted by steve w on July 09, 2001 8:06 PM

The "" means blank, also your ranges overlap not sure if thats what you wanted,
the Range("A27:Z142") will always print out.

Try this for a number
If Sheet16.Range("F2") = 2 Then

this for text
If Sheet16.Range("F2") = "YourText" Then

hope this helps
steve w