ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Autofill (https://www.excelbanter.com/excel-programming/315042-autofill.html)

carg1[_5_]

Autofill
 

How would I make autofill work in a macro without having to explicitl
specify the range of cells I want to fill? I have a sheet in which th
number of rows changes all the time, and I need to autofill equations a
the beginning of two columns

--
carg
-----------------------------------------------------------------------
carg1's Profile: http://www.excelforum.com/member.php...fo&userid=1527
View this thread: http://www.excelforum.com/showthread.php?threadid=27317


Tom Ogilvy

Autofill
 
Where to look to find the number of rows? Which columns.

--
Regards,
Tom Ogilvy

"carg1" wrote in message
...

How would I make autofill work in a macro without having to explicitly
specify the range of cells I want to fill? I have a sheet in which the
number of rows changes all the time, and I need to autofill equations at
the beginning of two columns.


--
carg1
------------------------------------------------------------------------
carg1's Profile:

http://www.excelforum.com/member.php...o&userid=15271
View this thread: http://www.excelforum.com/showthread...hreadid=273174




Dale Preuss[_2_]

Autofill
 
This assumes that column 1 contains all the rows that need the formula
applied to and cell H1 contains the initial formula. Duplicate the copy/paste
process for multiple, non-adjacent columns. For adjacent columns, you could
"resize" the copy (".Resize(1, 2)").

Sub procFillFormulas()
Cells(1, 8).Copy
Range(Cells(2, 8), Cells(Cells(Rows.Count, 1).End(xlUp).Row,
8)).PasteSpecial xlPasteFormulas
Application.CutCopyMode = False
End Sub

Dale Preuss

"carg1" wrote:


How would I make autofill work in a macro without having to explicitly
specify the range of cells I want to fill? I have a sheet in which the
number of rows changes all the time, and I need to autofill equations at
the beginning of two columns.


--
carg1
------------------------------------------------------------------------
carg1's Profile: http://www.excelforum.com/member.php...o&userid=15271
View this thread: http://www.excelforum.com/showthread...hreadid=273174




All times are GMT +1. The time now is 08:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com