Ive been stuck on this for the last 2 hours, this portion of my loop isnt working.
if the value in the current worksheet cell A1 matches the master sheet column B and the value in the current sheet columns "A" matches the master sheet column A
( but i would need the most recent value or match from the master sheet returned so i think i would need to run the loop from the bottom to the top because the values in column a will be on the master sheet multiple times with different dates)
after finding the matches the loop is supposed to then return columns G,H AND I from the master sheet in columns F,G,H of the current sheet. the data is there and it just wont pull the value over from the master sheet even though column a and b of the current sheet matches the values on the master sheet.... ive mobified this code so much with no results i am stuck. please help
"sub test()
For Each sht In ActiveWorkbook.Worksheets
If sht.Visible = True Then sht.Activate
y = 3
x = 2
Do
x = x + 1
If Range("A1") = ActiveWorkbook.Sheets("MASTER").Range("B" & x) And Range("A" & x).value = ActiveWorkbook.Sheets("MASTER").Range("A" & y). Then
Range("F" & y) = ActiveWorkbook.Sheets("MASTER").Range("G" & x).Value
Range("G" & y) = ActiveWorkbook.Sheets("MASTER").Range("H" & x).Value
Range("H" & y) = ActiveWorkbook.Sheets("MASTER").Range("I" & x).Value
y = y + 1
End If
Loop Until Sheets("MASTER").Cells(x, 1) > ""
Next sht
End sub "
if the value in the current worksheet cell A1 matches the master sheet column B and the value in the current sheet columns "A" matches the master sheet column A
( but i would need the most recent value or match from the master sheet returned so i think i would need to run the loop from the bottom to the top because the values in column a will be on the master sheet multiple times with different dates)
after finding the matches the loop is supposed to then return columns G,H AND I from the master sheet in columns F,G,H of the current sheet. the data is there and it just wont pull the value over from the master sheet even though column a and b of the current sheet matches the values on the master sheet.... ive mobified this code so much with no results i am stuck. please help
"sub test()
For Each sht In ActiveWorkbook.Worksheets
If sht.Visible = True Then sht.Activate
y = 3
x = 2
Do
x = x + 1
If Range("A1") = ActiveWorkbook.Sheets("MASTER").Range("B" & x) And Range("A" & x).value = ActiveWorkbook.Sheets("MASTER").Range("A" & y). Then
Range("F" & y) = ActiveWorkbook.Sheets("MASTER").Range("G" & x).Value
Range("G" & y) = ActiveWorkbook.Sheets("MASTER").Range("H" & x).Value
Range("H" & y) = ActiveWorkbook.Sheets("MASTER").Range("I" & x).Value
y = y + 1
End If
Loop Until Sheets("MASTER").Cells(x, 1) > ""
Next sht
End sub "