Issues when filling down a column in a macro

Walkerwood9

New Member
Joined
Jun 23, 2020
Messages
17
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I am having an issue with some code that has been working fine until now. I am having an issue where when my macro runs and starts to copy down a formula into the rest of the column it copies down the headers to the entire column instead.
Here is the code:

Range (“G427”).Select
Selection.End(xlDown).Select
ActiveCell.Offset(0,2).Select
Range(Selection, Selection.End(xlUp)).Select
Selection.FillDown

End of code:
The header is in row 2 and the column I am trying to fill out is column “I” specifically cells 427 and down. I am not sure why it keeps going up to the headers and copying those down all the way down the column..?!?
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Hi there.

The problem will be the xlUp selection you are doing. If column I is empty apart from the header, it will end up selecting the header row.
Try this instead:
VBA Code:
Sub ender()
Range("G427").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 2).Select
Range("I427", Selection).Select
Selection.FillDown
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,259
Members
449,075
Latest member
staticfluids

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