ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro to autofill formula? (https://www.excelbanter.com/excel-programming/278879-macro-autofill-formula.html)

Todd[_5_]

macro to autofill formula?
 
Hi. I want to auto fill and insert values into a
formula? I have a spread sheet that is full of formatting
so dragging a new formula down is impractical. So I am
wanting a macro that can find a formula and insert a
certain set of numbers both in the beginning and at the
end. How do I do this? It would have to recognize that
each cell is different and adjust as it fills down the
selected range. Is it practical to do this? I have been
reading past posts and haven't found anything yet to help
me.

Example:

=IF(EF11=0,"",$C11*EF11)
=IF(EF12=0,"",$C12*EF12)


Becomes

=IF(EF11<"",IF(EF11=0,"",$C11*EF11),"")
=IF(EF12<"",IF(EF12=0,"",$C12*EF12),"")



Thanks,


Todd


cdavis

macro to autofill formula?
 
Try using the Paste Special and only paste in the
formula. Then the formatting is not disturbed.

-----Original Message-----
Hi. I want to auto fill and insert values into a
formula? I have a spread sheet that is full of

formatting
so dragging a new formula down is impractical. So I am
wanting a macro that can find a formula and insert a
certain set of numbers both in the beginning and at the
end. How do I do this? It would have to recognize that
each cell is different and adjust as it fills down the
selected range. Is it practical to do this? I have been
reading past posts and haven't found anything yet to help
me.

Example:

=IF(EF11=0,"",$C11*EF11)
=IF(EF12=0,"",$C12*EF12)


Becomes

=IF(EF11<"",IF(EF11=0,"",$C11*EF11),"")
=IF(EF12<"",IF(EF12=0,"",$C12*EF12),"")



Thanks,


Todd

.


Todd[_5_]

macro to autofill formula?
 
Thanks, I didn't explain well enough. Headings (text) are
in the columns and pasting would replace them if I do not
select around them. I thought I maybe avoid the rows that
have text too as I work down the columns?

What I have right now is below. I can select the range
between the headings and use it but, it fills to the
bottom of the sheet. How do I use itand only fill my
range?


Sub autofilldownrange()
For Each cell In Selection
ActiveCell.AutoFill _
Destination:=Range(ActiveCell, _
ActiveCell.Offset(0, -1).End(xlDown).Offset(0, 1))
Next
End Sub

Todd.



-----Original Message-----
Try using the Paste Special and only paste in the
formula. Then the formatting is not disturbed.

-----Original Message-----
Hi. I want to auto fill and insert values into a
formula? I have a spread sheet that is full of

formatting
so dragging a new formula down is impractical. So I am
wanting a macro that can find a formula and insert a
certain set of numbers both in the beginning and at the
end. How do I do this? It would have to recognize that
each cell is different and adjust as it fills down the
selected range. Is it practical to do this? I have

been
reading past posts and haven't found anything yet to

help
me.

Example:

=IF(EF11=0,"",$C11*EF11)
=IF(EF12=0,"",$C12*EF12)


Becomes

=IF(EF11<"",IF(EF11=0,"",$C11*EF11),"")
=IF(EF12<"",IF(EF12=0,"",$C12*EF12),"")



Thanks,


Todd

.

.



All times are GMT +1. The time now is 11:54 AM.

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