October 5, 2010
Hi,
If data is filtered, for example in a table, VLOOKUP still returns the same data. Filtering has no effect.
Maybe if you explain what you are trying to do we can find a solution. Please supply a workbook with data and clear explanations of what you want and the expected result.
Thanks
Phil
August 3, 2020
I have some data in col Z. If i found "Error" in col Z then i want to do vlookup in AA. If there is no "Error" in col Z then i dont want to Vlookup it in column AA.
Now i'm stuck in the below code
If WorksheetFunction.CountIf(Range("Z:Z"), "Error") > 0 Then
With Sheets("PIR Template")
With .Range("A1:AH1")
.AutoFilter
.AutoFilter Field:=26, Criteria1:="Error"
End With
Range("AA" & cell.Row).Select.Formula = "=VLOOKUP(RC[-2],ZLOE019!C1:C7,7,0)"
End With
October 5, 2010
Hi,
When the Validation sub runs you have these 3 lines of code at the top
LR = Range("U" & Rows.Count).End(xlUp).Row
LR1 = Range("B" & Rows.Count).End(xlUp).Row
LR2 = Range("B" & Rows.Count).End(xlUp).Row
But these are acting on the active sheet which is FORM therefore they are all set to 1.
LR1 and LR2 are set to correct values later in your code, after you switch to other sheets. But LR is not set to any other value so the code that relies on it is not working properly.
At the top of the validation sub, activate the sheet you want before setting values for LR, LR1 and LR2.
Regards
Phil
October 5, 2010
Hi,
I'm a bit confused. I don't know what sheet you want the code to act upon.
All you need is a line like this
Sheets("PIR Template").Activate
before the 3 lines that set values for LR, LR1 an LR2.
I'm guessing that's the sheet you want but as I said, I don't know for sure. How can I know? You need to tell me what sheet you want the code to work with.
Regards
Phil
1 Guest(s)