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
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