Macro to test Null values

Closed
mrw - Aug 19, 2009 at 11:46 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Aug 19, 2009 at 09:31 PM
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 response

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Aug 19, 2009 at 09:31 PM
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
0