excel vba to drag down VLOOKUP formulas

BORUCH

Well-known Member
Joined
Mar 1, 2016
Messages
528
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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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,215,136
Messages
6,123,243
Members
449,093
Latest member
Vincent Khandagale

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