0% found this document useful (0 votes)
25 views2 pages

Vlkup SDR

This macro automates data processing in an Excel sheet by filtering and clearing specific ranges. It populates columns with formulas to perform VLOOKUP operations based on certain criteria and adjusts column widths. Finally, it pastes the values of the processed data back into the sheet.

Uploaded by

Izhar Mehdi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views2 pages

Vlkup SDR

This macro automates data processing in an Excel sheet by filtering and clearing specific ranges. It populates columns with formulas to perform VLOOKUP operations based on certain criteria and adjusts column widths. Finally, it pastes the values of the processed data back into the sheet.

Uploaded by

Izhar Mehdi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Sub Macro4()

'
' Macro4 Macro
'

'
lr = Cells.Find("*", Cells(1, 1), xlFormulas, xlPart, xlByRows, xlPrevious,
False).Row

Range("A1:V" & lr).Select


Selection.AutoFilter
Selection.End(xlUp).Select
Range("J1:K" & lr).Select
Selection.ClearContents
Range("J1").Select
ActiveCell.FormulaR1C1 = "week No"
Range("K1").Select
ActiveCell.FormulaR1C1 = "Mc No"
Range("J2").Select
ActiveSheet.Range("$A$1:$V$" & lr).AutoFilter Field:=1, Criteria1:= _
"TRANSACT"
Columns("G:G").ColumnWidth = 9.89
Range("G3").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(VALUE(LEFT(RC[-4],6)),Sheet2!C[-6]:C[-3],4,0)"
Range("G3").Select
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("J3").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(VALUE(LEFT(RC[-7],6)),Sheet2!C[-9]:C[-6],2,0)"
Range("J3").Select
Columns("J:J").ColumnWidth = 10.11
Columns("K:K").ColumnWidth = 13.11
Selection.Copy
Range("J" & lr).Select
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Selection.End(xlUp).Select
Range("J3").Select
Application.CutCopyMode = False

Range("K3").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(VALUE(LEFT(RC[-8],6)),Sheet2!C[-10]:C[-7],3,0)"
Range("K3").Select
Selection.Copy
Range("K" & lr).Select
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Selection.End(xlUp).Select
Application.CutCopyMode = False
ActiveSheet.ShowAllData
Range("G1:K" & lr).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("G1").Select
Application.CutCopyMode = False
End Sub

You might also like