ExcelBanter

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

angieg

excel autofill macro
 
Can someone please help me figure out a macro that I can use to autofil
a formula into all the cells below it until the data on the lef
quits?
This is the situation:
I have several worksheets that I have to insert the followin
formula(="t"&right(b2,12)) to cell d2. The problem I need help with i
that sometimes I have to copy this down to row 42 and sometimes I hav
to copy this to row 5300. It varies with each workbook. Can someon
please help me? This small macro would save me hours of time eac
week.
Thanks in advance for your help!

--
Message posted from http://www.ExcelForum.com


Anders S[_2_]

excel autofill macro
 
Probably no need for a macro, try this,

Enter the formula in D2, then select D2 and double-click the fill handle (the
little black square in the bottom right corner of the cell).

HTH
Anders Silven

"angieg " skrev i meddelandet
...
Can someone please help me figure out a macro that I can use to autofill
a formula into all the cells below it until the data on the left
quits?
This is the situation:
I have several worksheets that I have to insert the following
formula(="t"&right(b2,12)) to cell d2. The problem I need help with is
that sometimes I have to copy this down to row 42 and sometimes I have
to copy this to row 5300. It varies with each workbook. Can someone
please help me? This small macro would save me hours of time each
week.
Thanks in advance for your help!!


---
Message posted from http://www.ExcelForum.com/



Anders S[_2_]

excel autofill macro
 
One small addition,

This will not work if column C is empty. If so, enter the formula in column C.

Anders Silven

"Anders S" skrev i meddelandet
...
Probably no need for a macro, try this,

Enter the formula in D2, then select D2 and double-click the fill handle (the
little black square in the bottom right corner of the cell).

HTH
Anders Silven

"angieg " skrev i meddelandet
...
Can someone please help me figure out a macro that I can use to autofill
a formula into all the cells below it until the data on the left
quits?
This is the situation:
I have several worksheets that I have to insert the following
formula(="t"&right(b2,12)) to cell d2. The problem I need help with is
that sometimes I have to copy this down to row 42 and sometimes I have
to copy this to row 5300. It varies with each workbook. Can someone
please help me? This small macro would save me hours of time each
week.
Thanks in advance for your help!!


---
Message posted from http://www.ExcelForum.com/




Gord Dibben

excel autofill macro
 
Sub Auto_Fill()
Dim lrow As Long
With ActiveSheet
lrow = Range("B" & Rows.Count).End(xlUp).Row
Range("D2:D" & lrow).FillDown
End With
End Sub

Gord Dibben Excel MVP

On Mon, 17 May 2004 15:42:28 -0500, angieg
wrote:

Can someone please help me figure out a macro that I can use to autofill
a formula into all the cells below it until the data on the left
quits?
This is the situation:
I have several worksheets that I have to insert the following
formula(="t"&right(b2,12)) to cell d2. The problem I need help with is
that sometimes I have to copy this down to row 42 and sometimes I have
to copy this to row 5300. It varies with each workbook. Can someone
please help me? This small macro would save me hours of time each
week.
Thanks in advance for your help!!


---
Message posted from http://www.ExcelForum.com/



angieg[_2_]

excel autofill macro
 
Thanks to all for your fast response. I figured it out!! See cod
below. The reason I wanted a macro is because there are severa
columns that I needed to do this to 20 to 30 times a day, and typin
the same formula over and over gets soooo old. I'll definitely b
coming back here for more answers.

Angie

Sub autofill()
Dim LastRow As Long
With Worksheets("Sheet2")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
.Range("D2").autofill Destination:=.Range("D2:D" & LastRow) _
, Type:=xlFillDefault
End With
End Su

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 07:47 AM.

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