Quick vba question

leeb91

New Member
Joined
May 22, 2015
Messages
20
Hi, everyone
I need help on simple macro that will replicate a vlookup function. So, I have a table of values from H2:H9 in Sheet1 A value in H2 corresponds to the entire Column D in sheet 3 and the value needs to be copy/pasted into every cell in Column D from row 2 to the last row with data. Same for H3, H3 corresponds to the entire Column AC and a value in H3 must be copy/pasted into every cell in Column AC in sheet 3 from row 2 to the last row. I am using this code for figuring out the last line.

<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;">Dim lastRow AsLong
Dim rng As Range

Set rng = ThisWorkbook.Sheets(2).Cells

lastRow
= rng.Find(What:="*", After:=rng.Cells(1), Lookat:=xlPart, LookIn:=xlFormulas, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False).Row</code>



Can anyone please please help me?
Thank you
 

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

Forum statistics

Threads
1,203,629
Messages
6,056,417
Members
444,862
Latest member
more_resource23

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