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
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
ok lets say i have a VLOOKUP formula in cell j12 and cell k12 in the cell to the left of j12 there is data there in addition there is an empty row after the set of data i want it dragged down till the first empty row
 
Upvote 0
One way, the macro below
VBA Code:
Sub Fdown()
    Dim lr As Long
    lr = Worksheets("Sheet3").Cells(Rows.Count, "I").End(xlUp).Row
    Worksheets("Sheet3").Range("J12:K" & lr).FillDown
End Sub

turns
Book1
ABCDEFGHIJKLMNO
3horse1936463114
4pig2150492536
5lion4418323135
6tiger2535461147
7
8
9
10
11
12=VLOOKUP(N12,$A$1:$F$6,3,0)=VLOOKUP(O12,$A$1:$F$6,5,0)a1828liondog
13#N/A#N/Aacatpig
14#N/A#N/Aadoghorse
15#N/A#N/Aapiglion
16#N/A#N/Aahorsecat
Sheet3
Cell Formulas
RangeFormula
C12:D16C12=FORMULATEXT(J12)
J12J12=VLOOKUP(N12,$A$1:$F$6,3,0)
K12K12=VLOOKUP(O12,$A$1:$F$6,5,0)


into

Cell Formulas
RangeFormula
C12:D16C12=FORMULATEXT(J12)
J12:J16J12=VLOOKUP(N12,$A$1:$F$6,3,0)
K12:K16K12=VLOOKUP(O12,$A$1:$F$6,5,0)
 
Upvote 0
One way, the macro below
VBA Code:
Sub Fdown()
    Dim lr As Long
    lr = Worksheets("Sheet3").Cells(Rows.Count, "I").End(xlUp).Row
    Worksheets("Sheet3").Range("J12:K" & lr).FillDown
End Sub

turns
Book1
ABCDEFGHIJKLMNO
3horse1936463114
4pig2150492536
5lion4418323135
6tiger2535461147
7
8
9
10
11
12=VLOOKUP(N12,$A$1:$F$6,3,0)=VLOOKUP(O12,$A$1:$F$6,5,0)a1828liondog
13#N/A#N/Aacatpig
14#N/A#N/Aadoghorse
15#N/A#N/Aapiglion
16#N/A#N/Aahorsecat
Sheet3
Cell Formulas
RangeFormula
C12:D16C12=FORMULATEXT(J12)
J12J12=VLOOKUP(N12,$A$1:$F$6,3,0)
K12K12=VLOOKUP(O12,$A$1:$F$6,5,0)


into

Cell Formulas
RangeFormula
C12:D16C12=FORMULATEXT(J12)
J12:J16J12=VLOOKUP(N12,$A$1:$F$6,3,0)
K12:K16K12=VLOOKUP(O12,$A$1:$F$6,5,0)
ok but its not always in the same position i need the formula to find all VLOOKUP's wherever they are on the active sheet and fill it down
 
Upvote 0
ok but its not always in the same position i need the formula to find all VLOOKUP's wherever they are on the active sheet and fill it down
There is however a blank line between each group so wherever the vlookups are it will hit a blank row
 
Upvote 0
With the further information you have provided I think you need to provide an XL2BB of your data

It is not practical for me to code and search for random Vlookup's on a sheet.
Are there other formulas other than Vlookup's on the sheet?
Are the Vlookup's in a specific area?

I am at work now for the next 12 hours plus and will see if I get a chance to look at it when I get home
 
Upvote 0
With the further information you have provided I think you need to provide an XL2BB of your data

It is not practical for me to code and search for random Vlookup's on a sheet.
Are there other formulas other than Vlookup's on the sheet?
Are the Vlookup's in a specific area?

I am at work now for the next 12 hours plus and will see if I get a chance to look at it when I get home
see below the yellow is where the VLOOKUP's are

Book1
ABCDEFGHIJKLM
12Item #DescriptionOther 1Other 2Other 3Qty Price Qty Price Qty Price Qty Price
1300000test 110122011VLOOKUPVLOOKUP3010
1400001test 2drag downdrag down
1500002test 3
16
1700004test 5913VLOOKUPVLOOKUP259
1800005test 6drag downdrag down
1900006test 7
20
2100008test 910142015.66VLOOKUPVLOOKUP3014
22
2300011test 105100VLOOKUPVLOOKUP1090
2400012test 11drag downdrag down
2500013test 12
2600014test 13
2700015test 14
2800016test 15
Sheet1
 
Upvote 0
You're not referencing those merged cells in your Vlookup's are you?
 
Upvote 0

Forum statistics

Threads
1,215,136
Messages
6,123,246
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