Drag formula up dynamically

RioDegenero

New Member
Joined
Mar 1, 2023
Messages
23
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
  2. MacOS
Hi,

Any help on VBA code to "drag up" formula or "copy" formula up dynamically will be appreciated.

I will like to drag the formula in cell B25 up until B2 preferably (if not then B1 is fine). The starting row will not always be cell B25 every time as per the picture below. So I need the formula to be dynamic.
The formula is "EOMonth(B26,1)"
Recording the code, I have this:
Range("B25").Select
Selection.AutoFill Destination: = Range("B2:B25"), Type: = xlFillDefault
Range("B2:B25").Select


1678447699029.png
 
The marked solution has been marked accordingly. In your future questions, please mark the post as the solution that answered your question as it will help future readers. No further action is required for this thread.
 
Upvote 0

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
The marked solution has been marked accordingly. In your future questions, please mark the post as the solution that answered your question as it will help future readers. No further action is required for this thread.
Note, please how do I do this?
 
Upvote 0
So theres a trick to do this, what you need to do is the copy the last cell: in this case B26. Then press ctrl shift up to select the fill range and press ctrl v to fill the formula up.
 
Upvote 0

Forum statistics

Threads
1,213,554
Messages
6,114,280
Members
448,562
Latest member
Flashbond

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