Copy and Paste VBA with dynamic length

AnthDG

New Member
Joined
May 19, 2016
Messages
11
Good evening

I have a sheet whereby there is a dynamic column A and B with dates that populate (as time goes on, more dates appear etc.).
In the worksheet, there is some formulas in cells C:ZZ which use the data in Column A as an XLOOKUP.
The formulas in the worksheet don't auto populate the formulas in cells C:ZZ - is there a quick way to identify where the data in column A & B has continued to populate, the copy the last row from C:ZZ and paste in the blank rows C:ZZ up until the last rows data point.

i.e. if the dates go down to row 1047 and the last XLOOKUP formulas populate row 1045, can you copy the row 1045 and paste in C1046:ZZ1046 and C1047:ZZ1047

Example below:

Dynamic DatesDynamic DataINDX_ADJ_PEINDX_ADJ_PEINDX_ADJ_PEINDX_ADJ_PEINDX_ADJ_PEINDX_ADJ_PEINDX_ADJ_PEINDX_ADJ_PEINDX_ADJ_PEINDX_ADJ_PEheader
01/01/2021​
45.00​
13.00​
23.00​
88.00​
95.00​
88.00​
58.00​
80.00​
61.00​
52.00​
26.00​
89.00​
02/01/2021​
74.00​
16.00​
49.00​
65.00​
56.00​
47.00​
60.00​
77.00​
22.00​
86.00​
5.00​
86.00​
03/01/2021​
26.00​
69.00​
61.00​
15.00​
34.00​
31.00​
42.00​
47.00​
27.00​
24.00​
73.00​
97.00​
04/01/2021​
36.00​
57.00​
73.00​
78.00​
81.00​
48.00​
50.00​
85.00​
17.00​
77.00​
77.00​
57.00​
05/01/2021​
06/01/2021​
Thanks in advance!
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
How about
VBA Code:
Sub AnthDG()
   Dim UsdRws As Long
   
   Application.Calculation = xlCalculationManual
   UsdRws = Range("A" & Rows.Count).End(xlUp).Row
   With Range("C" & Rows.Count).End(xlUp)
      If .Row < UsdRws Then
         .Resize(, 700).AutoFill .Resize(UsdRws - .Row + 1, 700)
      End If
   End With
   Application.Calculation = xlCalculationAutomatic
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,821
Messages
6,181,163
Members
453,021
Latest member
Justyna P

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