excel vba to drag down VLOOKUP formulas

BORUCH

Well-known Member
Joined
Mar 1, 2016
Messages
537
Office Version
  1. 365
Platform
  1. Windows
hi

i have VLOOKUP formulas all over my worksheet starting from row 12 different spots i would like a vba that would find them all and drag it down same behavior like the fil handle till the first empty

thanks
 
Are your Vlookups only being dragged down to the one cell as you show?
 
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Try the code below on a copy of your data (please note it relies on no other formulas than the Vlookup's being in the range)

VBA Code:
Sub BORUCH()
    Dim myCell As Range, x As Range, y As Long
    
    For Each myCell In Range("H13:K28").SpecialCells(xlCellTypeFormulas, 23)
        Set x = Cells(myCell.Row, 1)
        
        If x.Offset(1) <> "" Then
            y = Range(x, x.End(xlDown)).Rows.Count
            myCell.Resize(y).Formula = myCell.Formula
        End If
    
    Next

End Sub
 
Upvote 0
Solution
Try the code below on a copy of your data (please note it relies on no other formulas than the Vlookup's being in the range)

VBA Code:
Sub BORUCH()
    Dim myCell As Range, x As Range, y As Long
   
    For Each myCell In Range("H13:K28").SpecialCells(xlCellTypeFormulas, 23)
        Set x = Cells(myCell.Row, 1)
       
        If x.Offset(1) <> "" Then
            y = Range(x, x.End(xlDown)).Rows.Count
            myCell.Resize(y).Formula = myCell.Formula
        End If
   
    Next

End Sub
Thanks that worked
 
Upvote 0

Forum statistics

Threads
1,223,098
Messages
6,170,099
Members
452,301
Latest member
QualityAssurance

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