Hello all
I am trying to add a Primary key in column "A" starting at "A13"
If there is a value in column "C" then add a number in column "A"
IE: "A13" would be 1
"A14" would be 2
"A15" would be 3
Below is a start but it needs to look at column "C"
and so on
I am trying to add a Primary key in column "A" starting at "A13"
If there is a value in column "C" then add a number in column "A"
IE: "A13" would be 1
"A14" would be 2
"A15" would be 3
Below is a start but it needs to look at column "C"
and so on
Code:
Sub Key()
Dim rng As Range
Set rng = Range("A13")
If IsEmpty(rng) Then
rng = 0
Else
If Not IsEmpty(rng.Offset(1, 0)) Then
Set rng = rng.End(xlDown)
End If
rng.Offset(1, 0) = rng.Value + 1
End If
End Sub