I have a script that asks for a starting cell
Set myCell = Application.InputBox( _
prompt:="Choose a starting field", Type:=8)
If myCell = Null Or myCell = "" Or Len(myCell.Value) < 3 Or Len(myCell.Value) > 12 Then
MsgBox "Incorrect cell value"
Exit Sub
Else
So, I have these checks for the value of the given cell so the script will not run if the validation does not go through. What I need is also for the validation to check whether the cell in certain column (D in my case).
So I need the validation to say "IS the selected cell in column D?" If Yes, continue, if no stop.
I've relentlessly googled to try to find this kind of comparison but I just fail to give it a good query.
Any help is appreciated. Thanks
With the help of Rich Holton I found the solution.
In order to check whether the input cell is in the column you want it to the following syntax can be used:
If myCell.Column <> 4 Then
...
End If
Where 4 is equal to Column D in this case. (Column A = 1, Column B = 2 and so on...)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.