W.E.B
asked on
VBA Replace &Total
Hello,
can you please help,
I need a vba that can compare Columns (AB, AE, AH, AK, AN) against CELL --- AR1
Example
AB3 is not = AR1 --- Then Empty cells AB3, AC3, AD3
AB4 is not = AR1 --- Then Empty cells AB4, AC4, AD4
and so on
AE2 is not = AR1 --- Then Empty cells AE2,AF2,AG2
AE3 is not = AR1 --- Then Empty cells AE3,AF3,AG3
and so on
AH2 is not = AR1 --- Then Empty cells AH2,AI2,AJ2
AH3 is not = AR1 --- Then Empty cells AH3,AI3,AJ3
and so on
AK2 is not = AR1 --- Then Empty cells AK2,AL2,AM2
AK3 is not = AR1 --- Then Empty cells AK3,AL3,AM3
and so on
AN2 is not = AR1 --- Then Empty cells AN2,AO2,AP2
AN3 is not = AR1 --- Then Empty cells AN3,AO3,AP3
and so on
Then a Total of Columns AD, AG, AJ, AM, AP in cell AP (LAST cell +1)
Please see attached sample.
Number of Rows is different.
Any help is appreciated.
thanks
sample.xlsx
can you please help,
I need a vba that can compare Columns (AB, AE, AH, AK, AN) against CELL --- AR1
Example
AB3 is not = AR1 --- Then Empty cells AB3, AC3, AD3
AB4 is not = AR1 --- Then Empty cells AB4, AC4, AD4
and so on
AE2 is not = AR1 --- Then Empty cells AE2,AF2,AG2
AE3 is not = AR1 --- Then Empty cells AE3,AF3,AG3
and so on
AH2 is not = AR1 --- Then Empty cells AH2,AI2,AJ2
AH3 is not = AR1 --- Then Empty cells AH3,AI3,AJ3
and so on
AK2 is not = AR1 --- Then Empty cells AK2,AL2,AM2
AK3 is not = AR1 --- Then Empty cells AK3,AL3,AM3
and so on
AN2 is not = AR1 --- Then Empty cells AN2,AO2,AP2
AN3 is not = AR1 --- Then Empty cells AN3,AO3,AP3
and so on
Then a Total of Columns AD, AG, AJ, AM, AP in cell AP (LAST cell +1)
Please see attached sample.
Number of Rows is different.
Any help is appreciated.
thanks
sample.xlsx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks you,
I added
Dim i As Long
i = 2
thanks
I added
Dim i As Long
i = 2
thanks
ASKER
thanks for your help,
the sample is working,
I just had to change the = to <>
If Range("AB" & i).Value <> C Then
If Range("AE" & i).Value <> C Then
If Range("AH" & i).Value <> C Then
If Range("AK" & i).Value <> C Then
If Range("AN" & i).Value <> C Then
when I copy the code to my sheet, I'm getting an error,
Variable not defined.
I'm using Excel 2007.
thanks