Macro to test Null values

[Closed]
Report
-
Posts
1862
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
July 30, 2015
-
Hello,

I have a spreadsheet where if I enter a numeric value between 3000 and 7000 (excluding values between 6000 and 6500) it checks to determine whether values in the same row are null. If they are, a message box appears indicating that null values are present). For exaple.

For Example: For any row if value in the column 'C' is NUMERIC and its value not between '6000' and '6500' then values in columns 'G' and 'R' can not be NULL

If anyone can assist that would be great !

Thanks,

Jenifer

1 reply

Posts
1862
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
July 30, 2015
800
try this macro
Assumptions.
row 1 is having column headings. data is from row 2. there is no gap in column A

Sub test()
Dim j As Integer, k As Integer
 j = Cells(1, 1).End(xlDown).Row
For k = 2 To j
If IsNumeric(Cells(k, "c")) And Cells(k, "c") < 6000 Or Cells(k, "c") > 8600 _
     And Cells(k, "G") = 0 Or Cells(k, "R") = 0 Then _
    MsgBox "null values are present"
Next k
End Sub

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!