File explore keep opening in macro

Alvaroro84

Board Regular
Joined
May 13, 2022
Messages
65
Office Version
  1. 2016
Platform
  1. Windows
VBA Code:
Sub vlooupReclass()
 With ActiveSheet
    .Range("A1").AutoFilter 4, "0"
    .AutoFilter.Range.Offset(1).Columns(4).FormulaR1C1 = "=VLOOKUP(RC[-3],[a]pivotable!R400000C3:R2C4,2,False)"
    .Range("D2:D" & Cells(Rows.count, "D").End(xlUp).Row).SpecialCells (xlCellTypeVisible)
    .Range("D" & Rows.count).End(xlUp).ClearContents
    .AutoFilterMode = False

    End With
     With ActiveSheet
    .Range("A1").AutoFilter 5, "0"
    .AutoFilter.Range.Offset(1).Columns(5).FormulaR1C1 = "=VLOOKUP(RC[-4],[a]pivotable!R400000C3:R2C4,2,False)"
    .Range("E2:E" & Cells(Rows.count, "E").End(xlUp).Row).SpecialCells (xlCellTypeVisible)
    .Range("E" & Rows.count).End(xlUp).ClearContents
    .AutoFilterMode = False

    End With
     With ActiveSheet
    .Range("A1").AutoFilter 6, "0"
    .AutoFilter.Range.Offset(1).Columns(6).FormulaR1C1 = "=VLOOKUP(RC[-5],[a]pivotable!R400000C3:R2C4,2,False)"
    .Range("F2:F" & Cells(Rows.count, "F").End(xlUp).Row).SpecialCells (xlCellTypeVisible)
    .Range("F" & Rows.count).End(xlUp).ClearContents
    .AutoFilterMode = False

    End With
    End Sub
This code works as i want it to work only issue is after it does the first column(column "D") it continues to open file explore over and over and doesn't move on to the next column in this case it doesn't move on to column E it gets stuck opening a ton of files explores. Is there a particular reason that its doing that and is there any way to get around it?
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,214,918
Messages
6,122,255
Members
449,075
Latest member
staticfluids

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