I want to check the value in column J and make sure it is not blank. I also want to…
Jump to turn (9)
- 1I want to check the value in column J and make sure it is not blank. I also want
- 2The value I am checking in column J could be in any cell. The value in column B
- 3The value I am checking in column J will be a specific cell and not the entire r
- 4it will be a specific cell any where in column J
- 5If Target.Column = 10 And Target.Value <> "" And InStr(1, targetCell.Offset(0, 1
- 6If Target.Column = 10 And Target.Value <> "" And InStr(1, targetCell.Offset(0, -
- 7The error in the following code say Object Required. If Target.Column = 10 And T
- 8I am not looking for a specifc value in column J. I only need to know if the cel
- 9how can i write the code for if target cell is J2 then do something
- User
I want to check the value in column J and make sure it is not blank. I also want to check the value in column B and make sure it doe not contain the word Request in the text string. If any of the checks are true then it should run the next code
- Assistant
block. Here's the code:
codeIf Not IsEmpty(Range("J1")) And InStr(1, Range("B1"), "Request") = 0 Then 'Run next code block here End IfThis code will first check if the value in J1 is not blank using the
IsEmptyfunction. If it is not empty, it will move to the next part of theIfstatement.The
InStrfunction is used to check if the word "Request" is present in the string in cell B1. If it is not present (which is indicated by a return value of 0), theIfstatement will evaluate to True and the code block following it will be executed. If the word "Request" is present in B1, the statement will evaluate to False and the code block will be skipped.