![]() |
Fill formula to last populated row
I am trying to set a macro to format Columns that will have varying number of
rows each time I run the program. I need to add some columns and fill in the formulas to the last populated row. I have been trying a few different styles but I can't get the ultimate result. |
Fill formula to last populated row
Try something like the following:
Sub AAA() Const C_WHAT_COLUMN = "A" Const C_START_ROW = 1 Const C_NUMBER_OF_COLUMNS = 4 Dim LastRow As Long Dim Rng As Range LastRow = Cells(Rows.Count, C_WHAT_COLUMN).End(xlUp).Row Set Rng = Range(Cells(C_START_ROW, C_WHAT_COLUMN), _ Cells(LastRow, C_WHAT_COLUMN)).Resize(, C_NUMBER_OF_COLUMNS) Rng.FillRight End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email on the web site) "Keep It Simple Stupid" wrote in message ... I am trying to set a macro to format Columns that will have varying number of rows each time I run the program. I need to add some columns and fill in the formulas to the last populated row. I have been trying a few different styles but I can't get the ultimate result. |
All times are GMT +1. The time now is 04:10 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com