dan.norman
New Member
- Joined
- Apr 15, 2010
- Messages
- 2
I need help with writing some sort of code that will look at everything I have in my "H" column and depending on what the cell contains, place a coresponding number into the next cell (column I). I am looking to do something sorta like this except to place the number in the entire column and not just I2.
Sub Test()
'
Set MyPage = Range("H2:H1200")
For Each Cell In Mypage
If Cell.Value = "YL/BL" Then
Range(I2).Value = 1
If Cell.Value = "YL/OR" Then
Range(I2).Value = 2
If Cell.Value = "YL/GR" Then
Range(I2).Value = 3
If Cell.Value = "YL/BR" Then
Range(I2).Value = 4
If Cell.Value = "YL/SL" Then
Range(I2).Value = 5
If Cell.Value = "YL/WH" Then
Range(I2).Value = 6
If Cell.Value = "YL/RD" Then
Range(I2).Value = 7
If Cell.Value = "YL/BK" Then
Range(I2).Value = 8
If Cell.Value = "YL/YL" Then
Range(I2).Value = 9
If Cell.Value = "YL/VI" Then
Range(I2).Value = 10
If Cell.Value = "YL/RS" Then
Range(I2).Value = 11
If Cell.Value = "YL/AQ" Then
Range(I2).Value = 12
If Cell.Value = "/0" Then
Range(I2).Value = 12
End If
End Sub
Sub Test()
'
Set MyPage = Range("H2:H1200")
For Each Cell In Mypage
If Cell.Value = "YL/BL" Then
Range(I2).Value = 1
If Cell.Value = "YL/OR" Then
Range(I2).Value = 2
If Cell.Value = "YL/GR" Then
Range(I2).Value = 3
If Cell.Value = "YL/BR" Then
Range(I2).Value = 4
If Cell.Value = "YL/SL" Then
Range(I2).Value = 5
If Cell.Value = "YL/WH" Then
Range(I2).Value = 6
If Cell.Value = "YL/RD" Then
Range(I2).Value = 7
If Cell.Value = "YL/BK" Then
Range(I2).Value = 8
If Cell.Value = "YL/YL" Then
Range(I2).Value = 9
If Cell.Value = "YL/VI" Then
Range(I2).Value = 10
If Cell.Value = "YL/RS" Then
Range(I2).Value = 11
If Cell.Value = "YL/AQ" Then
Range(I2).Value = 12
If Cell.Value = "/0" Then
Range(I2).Value = 12
End If
End Sub