ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populating column N where is is blank or null (https://www.excelbanter.com/excel-programming/311718-populating-column-n-where-blank-null.html)

steve

Populating column N where is is blank or null
 

I would like to write a macro that writes a formula in
Column N if:
i)Column A and Column H are not null/blank
ii)Column N is currently blank/null
It is important that the macro does not overwrite
values/formulas that are already in other rows of column H.

The formula should be column G minus column C

Thank you very much in advance.

Steve

Frank Kabel

Populating column N where is is blank or null
 
Hi
try the following macro:
Sub process_rows()
Dim lastrow As Long
Dim row_index As Long
Application.ScreenUpdating = False
lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
For row_index = 1 to lastrow
If Cells(row_index, 1).Value <"" and _
Cells(row_index, 8).Value <"" and _
cells(row_index,14).value="" then
cells(row_index,14).formulaR1C1="=R[0]C7-R[0]C3"
End If
Next
Application.ScreenUpdating = True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

"Steve" schrieb im Newsbeitrag
...

I would like to write a macro that writes a formula in
Column N if:
i)Column A and Column H are not null/blank
ii)Column N is currently blank/null
It is important that the macro does not overwrite
values/formulas that are already in other rows of column H.

The formula should be column G minus column C

Thank you very much in advance.

Steve




All times are GMT +1. The time now is 06:03 AM.

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