VBA Range issue

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello All--
I am relatively new to vba and I am designing some functions for use in excel. Basically, I want to check a range and make sure it is not empty. The code I pasted below is not working correctly. I have some values in the cells that are in the
range and it shows up as nothing. Then the if statement is not working correctly either. Thanks.

Private Sub CommandButton1_Click()<br/>
<br/>
ActiveWorkbook.Sheets("MACRO_LIBRARY_IN_EXCEL").Activate<br/>
Dim IRet As VbMsgBoxResult<br/>
Dim Data_column As Range<br/>
Set Data_column = Sheets("MACRO_LIBRARY_IN_EXCEL").Range("A1:A10")<br/>
If Data_column Is Nothing Then<br/>
IRet = MsgBox("The Range Entered does not have values.", vbOKOnly + vbExclamation, "Error Checking")<br/>
If IRet = vbOK Then<br/>
Exit Sub<br/>
End If<br/>
End If<br/>
End Sub


Sincerely,

Chris

View the full article
 
Back
Top