RockandGrohl
Well-known Member
- Joined
- Aug 1, 2018
- Messages
- 801
- Office Version
- 365
- Platform
- Windows
I am such a VBA noob.
In ML I need to set three variables, which are in H, A and G.
Then I go to PP (Price Panels) and loop all the way down until I find a match for all three variables.
Once this happens, I need it to hold whatever is in activecell on row A as a variable, then switch back to ML and paste that new variable in row R.
Once that happens, close the loop, go down a row in ML and re-open the loop.
I'm having trouble with getting it to come out of the loop, so the original loop can start again.
Do I put something like Do Until Cells = "" OR [condition to meet]?
I'm really confused, thanks.
EDIT: Lol, I've put in "Exit Do" after the "End If" in place of the Activecell offset, and it works. Leaving this up here to help others learn.
Code:
ML.Activate
Do Until Cells(ActiveCell.Row, "A") = ""
tnam = Cells(ActiveCell.Row, "H").Value
tno = Cells(ActiveCell.Row, "A").Value
pup = Cells(ActiveCell.Row, "G").Value
pp.Activate
Range("A3").Activate
Do Until Cells(ActiveCell.Row, "A") = ""
If Cells(ActiveCell.Row, "C").Value = tnam And Left(Cells(ActiveCell.Row, "A").Value, 6) <> tno And InStr(1, Cells(ActiveCell.Row, "K").Value, pup) > 0 Then
pptno = Cells(ActiveCell.Row, "A").Value
ML.Activate
Cells(ActiveCell.Row, "R").Value = pptno
End If
ActiveCell.Offset(1, 0).Activate
Loop
ActiveCell.Offset(1, 0).Activate
Loop
In ML I need to set three variables, which are in H, A and G.
Then I go to PP (Price Panels) and loop all the way down until I find a match for all three variables.
Once this happens, I need it to hold whatever is in activecell on row A as a variable, then switch back to ML and paste that new variable in row R.
Once that happens, close the loop, go down a row in ML and re-open the loop.
I'm having trouble with getting it to come out of the loop, so the original loop can start again.
Do I put something like Do Until Cells = "" OR [condition to meet]?
I'm really confused, thanks.
EDIT: Lol, I've put in "Exit Do" after the "End If" in place of the Activecell offset, and it works. Leaving this up here to help others learn.
Last edited: