Autofill in VBA only the formulas

Peter90

New Member
Joined
Jul 30, 2014
Messages
17
Could somebody help me please, how to use autofill for only the formulas (except the formatting) in column G for example until G20.
Thank you in advance!
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Could somebody help me please, how to use autofill for only the formulas (except the formatting) in column G for example until G20.
I think you need to tell us more about what is in Column G and exactly what you are trying to do with it. Do you have a mixture of constants, formulas and blanks in Column G? If so, are you trying to fill the blanks with the formulas? If so, is there always a formula above the first blank in a column of blanks? Could there ever be a constant above a blank and, if so, what should happen?
 
Upvote 0
Thank you for your willingness to help, during the time I was succeed in the macro. :)




Sub idotartam()

Dim i As Integer

Dim lastRow As Long

With ActiveSheet
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
For i = 3 To lastRow
Cells(i, 7).Value = "=IF(ISNUMBER(RC[-2])=FALSE,"""",IF(ISNUMBER(RC[-1])=FALSE,"""",IF(RC[-1]<RC[-2],""HIBÁS INTERVALLUM!"",IF(AND(RC[-2]<>"""",RC[-1]<>""""),DATEDIF(RC[-2],RC[-1],""D""),IF(AND(RC[-2]<>"""",RC[-1]=""""),"""",IF(AND(RC[-1]<>"""",RC[-2]=""""),"""",IF(AND(RC[-2]="""",RC[-1]=""""),"""",FALSE)))))))"

Next i

End Sub
 
Upvote 0
I have an other question, please help me if you have a little time:
Is there any way to start this macro automatic, if I start a new row (in column A) for example I write: "Hokuszpok" in next row after the last data contained row? Or Should I always click on a button?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,558
Latest member
aivin

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