SAM MADZLAN
New Member
- Joined
- Feb 20, 2018
- Messages
- 4
Hi All,
I have 1 filtered data that already been processed(1st set). with my 2nd set code, it overwrites current(1st set) value. Is there any way to make my code only process visible cell.
1st set
2nd set
I have 1 filtered data that already been processed(1st set). with my 2nd set code, it overwrites current(1st set) value. Is there any way to make my code only process visible cell.
1st set
Code:
Sub LookMAL1()
Dim x As String
Dim LastRow As Long
LastRow = Range("D" & Rows.Count).End(xlUp).Row
Range("M2").FormulaR1C1 = _
"=VLOOKUP(RC[-1],'MAL1'!C2:C8,7,0)"
Range("M2").Copy Range("M3:M" & LastRow)
Range("N2").FormulaR1C1 = _
"=VLOOKUP(RC[-2],'MAL1'!C2:C9,8,0)"
Range("N2").Copy Range("N3:N" & LastRow)
End Sub
2nd set
Code:
Sub LookMAL6()
Dim LastRow As Long
LastRow = Range("D" & Rows.Count).End(xlUp).Row
Range("M2").FormulaR1C1 = _
"=VLOOKUP(RC[-1],'MAL6'!C2:C8,7,0)"
Range("M2").Copy Range("M3:M" & LastRow)
Range("N2").FormulaR1C1 = _
"=VLOOKUP(RC[-2],'MAL6'!C2:C9,8,0)"
Range("N2").Copy Range("N3:N" & LastRow)
End Sub