Hi all,
Im quit a noob when it comes to ranges in VBA. I have a code that needs to applied to a range if possible, rather than entering the code I have multiple times.
When cell I13 has a certain text value, J13 must be mandatory. if J13 is not filled in, a messagebox appears. on the other hand, when I13 does not contain that specific text, J13 must be empty. Otherwise a messagebox appears.
I have the following code for this:
If [I13].value ="DRY ICE" and [J13] =vbNullstring Then
MsgBox "aantal is verplicht"
Exit sub
Elseif [I13].value <> "DRY ICE" and [J13] <> vbNullString then
Msgbox "geen DRY ICE"
Exit sub
End if
The code works fine, but should be applicable to range (I13:I31). As I've no idea how to put in the range, I could use some help on this.
Im quit a noob when it comes to ranges in VBA. I have a code that needs to applied to a range if possible, rather than entering the code I have multiple times.
When cell I13 has a certain text value, J13 must be mandatory. if J13 is not filled in, a messagebox appears. on the other hand, when I13 does not contain that specific text, J13 must be empty. Otherwise a messagebox appears.
I have the following code for this:
If [I13].value ="DRY ICE" and [J13] =vbNullstring Then
MsgBox "aantal is verplicht"
Exit sub
Elseif [I13].value <> "DRY ICE" and [J13] <> vbNullString then
Msgbox "geen DRY ICE"
Exit sub
End if
The code works fine, but should be applicable to range (I13:I31). As I've no idea how to put in the range, I could use some help on this.