Fill in the blanks

S

sailor4life61

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
 
D

Dave Peterson

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


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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top