![]() |
Fill in the blanks
Hello,
I would like to fill in the blanks cells in column A row 14 through last used row with the formula =mid(A2,2,10). Column B has last used row. Im trying unsucessfully to use something like, but it isn't filling in the blanks: Dim LastRow As Long Dim rng As Range Dim i As Long LastRow = Cells(Rows.Count, "B").End(xlUp).Row For i = 14 To cLastRow 'If Cells(i, "A").Value = "" Then Cells(i, "A").Formula = "=MID(R[-12]C[2],2,10)" ' End If Next i Thank you |
Fill in the blanks
You changed a variable name (LastRow vs cLastRow) and you'd want to use
..FormulaR1C1 (not .formula) since you're creating a formula using R1C1 reference style: Dim LastRow As Long Dim rng As Range Dim i As Long LastRow = Cells(Rows.Count, "B").End(xlUp).Row For i = 14 To LastRow 'If Cells(i, "A").Value = "" Then Cells(i, "A").FormulaR1C1 = "=MID(R[-12]C[2],2,10)" ' End If Next i On 06/25/2010 10:34, wrote: Hello, I would like to fill in the blanks cells in column A row 14 through last used row with the formula =mid(A2,2,10). Column B has last used row. Im trying unsucessfully to use something like, but it isn't filling in the blanks: Dim LastRow As Long Dim rng As Range Dim i As Long LastRow = Cells(Rows.Count, "B").End(xlUp).Row For i = 14 To cLastRow 'If Cells(i, "A").Value = "" Then Cells(i, "A").Formula = "=MID(R[-12]C[2],2,10)" ' End If Next i Thank you -- Dave Peterson |
All times are GMT +1. The time now is 05:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com