VBA copy-paste down column, without stopping at non-blank cells.

heathball

Board Regular
Joined
Apr 6, 2017
Messages
112
Office Version
  1. 365
Platform
  1. Windows
Sub copy_down_paste_calcV2()
ActiveCell.AutoFill Range(ActiveCell, ActiveCell.Offset(0, -1).End(xlDown).Offset(0, 1))
Selection.EntireColumn.Select
If TypeName(Selection) = "Range" Then Selection.Calculate
Selection(2).Select
End Sub


I'm experiencing problems achieving something that to me seems rather simple.

I am hoping to get this code to refer to the last cell in column A, and not to the column to its immediate left, as the indicator of the last row for the autofill to reach.

-Column A is text, has no blank cells.
I use this many times on the same sheet, in different columns, therefore the "offset" idea appears to not be where i need to be?
I have found no solutions which do not require the actual column to be referenced. So i am looking for a generic/active-column solution to be used in any column of choice, with the autofill going down to the last row of data on Column A, and overriding any cells that are in the column. That is why i have added the "Selection.EntireColumn.Select."

It may be an ugly code, as i am not a pro, but it works efficiently on my large files (900,000 rows) so far.

Thanks in advance for any assistance.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Maybe
VBA Code:
ActiveCell.AutoFill Range(ActiveCell, Intersect(ActiveCell.EntireColumn, Range("A" & Rows.Count).End(xlUp).EntireRow))
Thats awesome, thanks. I will look into this "intersect" idea> Interesting.
I changed the 'activeCell" to "selection" which allows it to operate on unlimited columns, and not just the 1.
 
Upvote 0

Forum statistics

Threads
1,215,101
Messages
6,123,095
Members
449,095
Latest member
gwguy

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