I am trying to get VBA to change the cell focus on the sheet. I can get it to work with one condition, but not two or more.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("c2:c5000")) Is Nothing Then Target(1, 8).Select
If Not Intersect(Target, Range("h2:h5000")) Is Nothing Then
Target(2, -6).Select
End If
End Sub
But this doesn't do what I want.
Here's what I want:
1. User enters data into column A
2. vlookup function in columns b:g should bring up product information, then focus goes to column i
3. after user enters data into column i, focus should go to next row, first column (this does work from above)
4. if step 2 comes up as N/A then i want focus to go to column b for user input.
5. after user inputs in column b then to column i and step 3.
This is giving me a headache. I'm good with excel, but not vb.
Thanks in advance!
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("c2:c5000")) Is Nothing Then Target(1, 8).Select
If Not Intersect(Target, Range("h2:h5000")) Is Nothing Then
Target(2, -6).Select
End If
End Sub
But this doesn't do what I want.
Here's what I want:
1. User enters data into column A
2. vlookup function in columns b:g should bring up product information, then focus goes to column i
3. after user enters data into column i, focus should go to next row, first column (this does work from above)
4. if step 2 comes up as N/A then i want focus to go to column b for user input.
5. after user inputs in column b then to column i and step 3.
This is giving me a headache. I'm good with excel, but not vb.
Thanks in advance!