I want my formula to follow the target cell

Viewed 34

Good Day,

I want this code to follow the target cell (G20) even if I inserted a multiple rows before row 20

=LEFT(G20,3)&TEXT(COUNTIF(G20:G20,LEFT(G20,1)&"*"),"000")

Thank you,

Is it also possible to set INDRECT code for Cell D20?

Private Sub CommandButton1_Click()
Dim x As String, rcell As Range, y As String, z As Long

x = "RFP" & Format(Now, "mmddyyhhmmss")
y = Left(x, 10)
z = Right(x, 2)

For Each rcell In Range("D20:D" & Range("D" & Rows.Count).End(3).Row)
If Cells(rcell.Row, 1) = "" Then Cells(rcell.Row, 1) = y & z
z = z + 1
Next rcell

End Sub
3 Answers
Related