Forum Discussion
anniethoang
Aug 01, 2023Copper Contributor
Automatic content fill-in in a new column
Hi - I need help categorizing content/ auto-fill from the column A to column B. For example, all the cells in column A with "Argentina" automatically abbreviates to "AR" in corresponding row in colum...
OliverScheurich
Aug 01, 2023Gold Contributor
Sub abbreviation()
Dim i, j As Long
j = Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To j
Select Case Cells(i, 1).Value
Case Is = "argentina"
Cells(i, 2).Value = "AR"
Case Is = "aruba"
Cells(i, 2).Value = "AA"
Case Is = "belgium"
Cells(i, 2).Value = "BE"
End Select
Next i
End Sub
Maybe with these lines of code. In the attached file you can run the macro to fill in the abbreviations.
anniethoang
Aug 02, 2023Copper Contributor
is there a simpler way with no code?
- OliverScheurichAug 02, 2023Gold Contributor
You could apply INDEX and MATCH along with a reference table. INDEX and MATCH with reference table should be simpler than VBA. However the formula has to be draged down which could slow down the file.