![]() |
Lopp Formula
I am trying to add a formula to a macro and don't know where to being.
Beginning on row 2 and continuing on I have a number in Column J. In column L I would like to have a formula that is "Column J/100" then in column m have a second formula that is "Column E * Column L". The number of rows wil vary but will always begin with row 2 and column I will always contain data. Any help would be greatly appreciated. Thanks |
Lopp Formula
this should help
Sub addformula() RowNumber = 2 Range("L" & RowNumber).Formula = "=(J" & RowNumber & ")/100" Range("M" & RowNumber).Formula = "=E" & RowNumber & "* L" & RowNumber End Sub "Rob Moore" wrote: I am trying to add a formula to a macro and don't know where to being. Beginning on row 2 and continuing on I have a number in Column J. In column L I would like to have a formula that is "Column J/100" then in column m have a second formula that is "Column E * Column L". The number of rows wil vary but will always begin with row 2 and column I will always contain data. Any help would be greatly appreciated. Thanks |
Lopp Formula
You don't always have to loop. You can have your code behave like you do when
you select a bunch of cells and type the formula once and then hit ctrl-enter to fill all the cells in the selection. Option Explicit Sub testme() Dim LastRow As Long With ActiveSheet LastRow = .Cells(.Rows.Count, "I").End(xlUp).Row .Range("L2:L" & LastRow).Formula = "=j2/100" .Range("M2:M" & LastRow).Formula = "=e2*l2" End With End Sub Rob Moore wrote: I am trying to add a formula to a macro and don't know where to being. Beginning on row 2 and continuing on I have a number in Column J. In column L I would like to have a formula that is "Column J/100" then in column m have a second formula that is "Column E * Column L". The number of rows wil vary but will always begin with row 2 and column I will always contain data. Any help would be greatly appreciated. Thanks -- Dave Peterson |
All times are GMT +1. The time now is 05:23 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com