Sam1023423
New Member
- Joined
- Apr 9, 2024
- Messages
- 4
- Office Version
- 2016
- Platform
- Windows
- Web
How to put slash with word and ascending numbers in excel with VBA
Thanks in advance.
Thanks in advance.
Sub AppendCategories()
Dim a, b
Dim i As Long, j As Long
Dim numRow As Long, counter As Long
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Sheet1") 'Change as needed
numRow = Cells(Rows.Count, "B").End(xlUp).Row
a = ws.Range("A1:B" & numRow).Value
counter = 1
ReDim b(1 To numRow, 1 To 2)
For i = 1 To numRow
For j = 1 To 2
If Not IsEmpty(a(i, j)) Then
b(i, j) = a(i, j) & "/category" & counter
counter = counter + 1
End If
Next j
Next i
ws.Range("D1").Resize(UBound(b, 1), 2).Value = b
End Sub