I am looking for direction on VBA code for Excel.
I have information exported from a schematic and parts list. There are usually 3-5 items at the beginning of the parts list that do not have reference designators (ref des), and several items at the end of the parts list that don't have ref des assigned.
The first blank group (beginning of parts list) I would like to assign the ref des as "A" and an incremented number (ie A1, A2, A3).
I would like to assign the next group of blank items found at the end of the list as "X" plus the number (X1, X2, X3, X4).
The only thing I have been able to find is filling with all the same text, or just numbers. I have found no way to designate the different groups.
Example of file data:
Pos RefDes Part Number
1 1-234
2 2-345
3 3-456
20 C1 5-678
21 C2 6-789
22 C3 7-345
158 U14 8-456
159 U18 8-058
167 9-176-1
168 9-272-1
169 10-349-1
171 10-883-1
172 11-1441-1
So it would be logic like: if info in column A (Pos) but not in B (RefDes) the B="A1", next incremented number until B (RefDes) is not empty, then next empty B (Ref Des) cell where A (Pos) is populated then (RefDes) B="X1" incremented until A (Pos) is empty (end of range)
Hope this is enough information.
This is an example of what I was using but didn't work for the second group and I don't want to have to search for specific text as it could be slightly different.
Sub AddRefDes_IfBlank()
Dim X As String
Dim n As Integer
On Error Resume Next
Cells.Find(What:="PWA", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell(1, -1).Select
ActiveCell.FormulaR1C1 = "A1"
'more of the same then End Sub