VBA: Autofill current selected cell down according to adjacent column. Columns will be dynamic.

CtJester7807

New Member
Joined
Mar 11, 2020
Messages
6
Office Version
  1. 2019
Hi All,

I've been trying to solve this for a few days now. I am relatively new to VBA, and I am running into trouble due to the data in my worksheets being dynamic.

I need to autofill a formula down to the last row of the adjacent column next to it. The problem I'm running into, is I'm not sure what to title my range, as it wont always be column D for example. I'm aware I can just copy my formula to the bottom of the page, but I would like to keep it cleaner than that. I have been using ActiveCell to drive my steps since I can't rely on any hard coded cells.

What do I need to put in my range, so it selects everything below my active cell down to the last cell of the adjacent column (the column to the left). I also know offset will be used here.

The below is what I have so far.

Cells.Find("Average").Select

Selection.EntireColumn.Offset(0, 1).Insert Shift:=xlToLeft

Selection.End(xlUp).Offset(0, 1).Activate

ActiveCell.Value = "ABS"

ActiveCell.Offset(1, 0).Select

ActiveCell.FormulaR1C1 = "=ABS(RC[-1])"

ActiveCell.Range().FillDown

Thank you!
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,223,927
Messages
6,175,441
Members
452,641
Latest member
Arcaila

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