Hi,
I need to seek assistance in regard to AutoFilter.
First, I need to filter Code "A", "B", "C". If code "A" is filtered and my row = 3 I will replace
the value into COFFEE, TEE, CHOCOLATE. And if code "B" is filtered and my row=2 then I will replace
the value into COFFEE, TEE and lastly if code "C" filtered and my row =1 I will replace the value
into COFFEE.
Scenario:
Code Value CRITERIA
A 10 COFFEE
B 20 TEA
C 30 CHOCOLATE
A 40
B 50
A 60
OUTPUT:
Code Value
A COFFEE
B TEA
C CHOCOLATE
A COFFEE
B TEA
A COFFEE
I started my code with this but I was stacked in here. I Hope someone will help me with my code.
Sub demo()
With ActiveSheet
Set rnData = .UsedRange
With rnData
.AutoFilter Field:=1, Criteria1:="A"
.Select
For Each rngarea In .SpecialCells(xlCellTypeVisible).Areas
lcount = lcount + rngarea.Rows.Count
Next
lcount2 = lcount - 1
<<don't know whats next>>
End With
End With
End Sub
Thank you so much.
Bookmarks