View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Desert Piranha[_47_] Desert Piranha[_47_] is offline
external usenet poster
 
Posts: 1
Default AutoFill Formula with code


Hi Gary, Dave, Norman,

I got Garys code to kinda work, needs tweeking.

Normans code is copy and paste, Works Great.

With the:

Application.EnableEvents = False
Application.EnableEvents = True

stuff, the code dosn't run so i am leaving it out.

Thx much for all the input.
Dave

Norman Jones Wrote:
Hi Dave,

Try:

'=============
Private Sub Worksheet_Change(ByVal Target As Range)
Dim LRow As Long
If Target.Column = 3 Then
LRow = Cells(Rows.Count, 3).End(xlUp).Row
Range("G2").AutoFill Destination:=Range("G2:G" & LRow)
Range("I2").AutoFill Destination:=Range("I2:I" & LRow)
Range("J2").AutoFill Destination:=Range("J2:J" & LRow)
End If
End Sub
'<<=============


---
Regards,
Norman


"Desert Piranha"
<Desert.Piranha.22tya2_1139266810.6088@excelforu m-nospam.com wrote in
message
news:Desert.Piranha.22tya2_1139266810.6088@excelfo rum-nospam.com...

Hi all,

This whole thing needs to change based on the last used cell in

column
C.

There is a formula in:
G2 '=IF(D2="","",(D2*F2))
I2 '=IF(D2="","",(H2/G2))
J2 '=IF(E2="","",(H2/E2))

Want to Auto Fill the formulas down, but only down as far as the

last
used cell in column C.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 Then
With Cells(Rows.Count, 3).End(xlUp).Select
Range("g2").AutoFill Destination:=Range("g3 to ???????")
Range("I2").AutoFill Destination:=Range("I3 to ???????")
Range("J2").AutoFill Destination:=Range("J3 to ???????")
End With
End If
End Sub

Any Direction would be great.


--
Desert Piranha



------------------------------------------------------------------------
Desert Piranha's Profile:
http://www.excelforum.com/member.php...o&userid=28934
View this thread:

http://www.excelforum.com/showthread...hreadid=509141



--
Desert Piranha


------------------------------------------------------------------------
Desert Piranha's Profile: http://www.excelforum.com/member.php...o&userid=28934
View this thread: http://www.excelforum.com/showthread...hreadid=509141