Hello, I'm having issues with this
I'm trying to fill column A with abbreviations of Column B and it is til the last filled row in B,
I tried doing this but it doesn't return any results at all, can anyone help me with this? thank you in advance~
Book1.xlsm | ||||
---|---|---|---|---|
A | B | |||
1 | Abrreviation | Transport | ||
2 | Bus | Bus.inc | ||
3 | Bus.inc | |||
4 | Bus.inc | |||
5 | Bus.inc | |||
6 | Bus.inc | |||
7 | Bus.inc | |||
8 | Car | Car co. | ||
9 | Car co. | |||
10 | Car co. | |||
11 | Car co. | |||
12 | Car co. | |||
13 | Motorbike | Motorcycle ptd ltd | ||
14 | Motorcycle ptd ltd | |||
15 | Motorcycle ptd ltd | |||
16 | Motorcycle ptd ltd | |||
17 | Motorcycle ptd ltd | |||
18 | Motorcycle ptd ltd | |||
19 | Bicycle | Bicycle ltd | ||
20 | Bicycle ltd | |||
21 | Bicycle ltd | |||
22 | Bicycle ltd | |||
23 | Bicycle ltd | |||
24 | Bicycle ltd | |||
25 | Bicycle ltd | |||
Sheet3 |
I'm trying to fill column A with abbreviations of Column B and it is til the last filled row in B,
VBA Code:
Sub EcomClass()
Application.ScreenUpdating = False
Dim ws As Worksheet
Dim i As Long, l As Long
Dim r As Range, rr As Range
Set ws = ThisWorkbook.Sheets("sheet3")
i = ws.Range("B" & Rows.Count).End(xlUp).Row
Set r = ws.Range("A2:A" & i)
For Each rr In r
If Cells(i, 2).Value = "Car Co." Then
r.Value = "Car"
ElseIf Cells(i, 2).Value = "Bus.inc" Then
r.Value = "Bus"
End If
Next
Set ws = Nothing
Set r = Nothing
Application.ScreenUpdating = True
End Sub
I tried doing this but it doesn't return any results at all, can anyone help me with this? thank you in advance~