VBA auto record macro change help required

mohdamir1989

New Member
Joined
Oct 17, 2017
Messages
42
Hi,

I need some help in below code. I recorded the macro and this code generated.

It should save file in same format at the end that part I deleted because it asked for xlsm format so I did to get the code.

What I was doing in this code is basically.

1. Filter "Pending" "Mobile" Status in current sheet.
2. Then Select "P bell" and
3. lookup data against "B" Column from "January Feedback1.xlsx" (Range B:Z) (If possible it should paste values only as I recorded the Macro, I am not sure how to do that part)
4. Save File in current format (xlsx)

Code:
Sub Macro1()'
' Macro1 Macro
'


'
    Rows("1:1").Select
    Range("F1").Activate
    Selection.AutoFilter
    Range("M1").Select
    ActiveSheet.Range("$A$1:$BH$2608").AutoFilter Field:=13, Criteria1:= _
        "P bell"
    Range("V1").Select
    ActiveSheet.Range("$A$1:$BH$2608").AutoFilter Field:=22, Criteria1:= _
        "pending"
    Range("Q2580").Select
    ActiveCell.FormulaR1C1 = _
        "=VLOOKUP(RC[-15],'[January Feedback1.xlsx]Daily Feedback'!R2C2:R1048576C63,16,0)"
    Range("Q2580").Select
    Selection.Copy
    Range("Q2581").Select
    ActiveSheet.Paste
    Range("T2580").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
        "=VLOOKUP(RC[-18],'[January Feedback1.xlsx]Daily Feedback'!C2:C63,19,0)"
    Range("T2580").Select
    ActiveCell.FormulaR1C1 = _
        "=VLOOKUP(RC2,'[January Feedback1.xlsx]Daily Feedback'!C2:C63,19,0)"
    Range("T2580").Select
    Selection.Copy
    Range("U2580").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
        "=VLOOKUP(RC2,'[January Feedback1.xlsx]Daily Feedback'!C2:C63,20,0)"
    Range("U2580").Select
    Selection.Copy
    Range("V2580").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
        "=VLOOKUP(RC2,'[January Feedback1.xlsx]Daily Feedback'!C2:C63,21,0)"
    Range("V2580").Select
    Selection.Copy
    Range("W2580").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
        "=VLOOKUP(RC2,'[January Feedback1.xlsx]Daily Feedback'!C2:C63,22,0)"
    Range("W2580").Select
    Selection.Copy
    Range("X2580").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
        "=VLOOKUP(RC2,'[January Feedback1.xlsx]Daily Feedback'!C2:C63,23,0)"
    Range("X2580").Select
    Selection.Copy
    Range("Y2580").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
        "=VLOOKUP(RC2,'[January Feedback1.xlsx]Daily Feedback'!C2:C63,24,0)"
    Range("Y2580").Select
    Selection.Copy
    Range("Z2580").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
        "=VLOOKUP(RC2,'[January Feedback1.xlsx]Daily Feedback'!C2:C63,25,0)"
    Range("T2580:Z2580").Select
    Selection.Copy
    Range("T2581").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Range("M1").Select
    Selection.AutoFilter
    Windows("January Feedback1.xlsx").Activate
    Windows("Jan 2018 Feedback file.xlsx").Activate
    ChDir _
        
End Sub

Your kind help in this regard is highly appreciated. Thanking you in advance

Best Regards
 
Last edited:

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,224,933
Messages
6,181,843
Members
453,068
Latest member
DCD1872

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top