Hi everyone,
The below code is designed to pick up variable levar from a list of values in the Masterlist tab and colour each row from the JDE Cardex tab in which levar appears. While it does this, the code would not stop searching for levar once the Do Until condition is fulfilled and thus searches for the first levar forever. Please help since I have been trying to fix this for one full day without success
Thanks a lot!
Alex
Sheets("Masterlist").Select
ActiveSheet.Cells(1, 1).CurrentRegion.Select
liniutze = Selection.Rows.Count
Dim levar As String
Dim numero As Integer
Dim rain As String
For g = 2 To liniutze
levar = Sheets("Masterlist").Cells(g, 1).Value
numero = 15
Do Until rain = "GRAND TOTAL"
For t = 2 To 600
Sheets("JDE Cardex").Select
On Error Resume Next
Worksheets("JDE Cardex").Columns("A").Find(What:=levar, After:=Cells(numero + 1, 1), LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).EntireRow.Select
numero = ActiveCell.Row
Sheets("JDE Cardex").Rows(numero).EntireRow.Interior.ColorIndex = 27
ActiveSheet.Cells(numero + 1, 1).Activate
Cells.FindNext(After:=ActiveCell).Activate
rain = Sheets("JDE Cardex").Cells(numero + 4, 4).Value
Next t
Loop
Next g
The below code is designed to pick up variable levar from a list of values in the Masterlist tab and colour each row from the JDE Cardex tab in which levar appears. While it does this, the code would not stop searching for levar once the Do Until condition is fulfilled and thus searches for the first levar forever. Please help since I have been trying to fix this for one full day without success
Thanks a lot!
Alex
Sheets("Masterlist").Select
ActiveSheet.Cells(1, 1).CurrentRegion.Select
liniutze = Selection.Rows.Count
Dim levar As String
Dim numero As Integer
Dim rain As String
For g = 2 To liniutze
levar = Sheets("Masterlist").Cells(g, 1).Value
numero = 15
Do Until rain = "GRAND TOTAL"
For t = 2 To 600
Sheets("JDE Cardex").Select
On Error Resume Next
Worksheets("JDE Cardex").Columns("A").Find(What:=levar, After:=Cells(numero + 1, 1), LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).EntireRow.Select
numero = ActiveCell.Row
Sheets("JDE Cardex").Rows(numero).EntireRow.Interior.ColorIndex = 27
ActiveSheet.Cells(numero + 1, 1).Activate
Cells.FindNext(After:=ActiveCell).Activate
rain = Sheets("JDE Cardex").Cells(numero + 4, 4).Value
Next t
Loop
Next g