Hi,
Help please, been trawling forums but cannot see a way of doing the following:
Raw data
A B
1234-5678
2345-6789
3456-7891
4567-8911
the first 4 digits never change, based on these numbers I need to do add numbers in Column A:
A B
2 1234-5678
3 2345-6789
4 3456-7891
4 4567-8911
The 3456-7891 & 4567-8911 will always have the same number, but that number will vary depending on if the 2345-6789 is present.
Below is a bigger snap shot of the data.
Raw data (The ------ is just to breakup the numbers for easier viewing in this forum and show a pattern)
A B A B
1234-5678 2 1234-5678
2345-6789 3 2345-6789
3456-7891 4 3456-7891
4567-8911 4 4567-8911
------------
1234-5678 2 1234-5678
3456-7891 3 3456-7891
4567-8911 3 4567-8911
------------
1234-5678 2 1234-5678
2345-6789 3 2345-6789
3456-7891 4 3456-7891
4567-8911 4 4567-8911
The code I have written so far is
Sub IF_statement()
Dim cell As Range
For Each cell In Range("b23:B100")
If Left(cell.Value, 4) = "1234" Then cell.Offset(0, -1) = 2
If Left(cell.Value, 4) = "2345" Then cell.Offset(0, -1) = 3
If Left(cell.Value, 4) = "3456" Then cell.Offset(0, -1) =
If Left(cell.Value, 4) = "4567" Then cell.Offset(0, -1) =
Next
End Sub
Hope someone can help, many thanks in advance.
Help please, been trawling forums but cannot see a way of doing the following:
Raw data
A B
1234-5678
2345-6789
3456-7891
4567-8911
the first 4 digits never change, based on these numbers I need to do add numbers in Column A:
A B
2 1234-5678
3 2345-6789
4 3456-7891
4 4567-8911
The 3456-7891 & 4567-8911 will always have the same number, but that number will vary depending on if the 2345-6789 is present.
Below is a bigger snap shot of the data.
Raw data (The ------ is just to breakup the numbers for easier viewing in this forum and show a pattern)
A B A B
1234-5678 2 1234-5678
2345-6789 3 2345-6789
3456-7891 4 3456-7891
4567-8911 4 4567-8911
------------
1234-5678 2 1234-5678
3456-7891 3 3456-7891
4567-8911 3 4567-8911
------------
1234-5678 2 1234-5678
2345-6789 3 2345-6789
3456-7891 4 3456-7891
4567-8911 4 4567-8911
The code I have written so far is
Sub IF_statement()
Dim cell As Range
For Each cell In Range("b23:B100")
If Left(cell.Value, 4) = "1234" Then cell.Offset(0, -1) = 2
If Left(cell.Value, 4) = "2345" Then cell.Offset(0, -1) = 3
If Left(cell.Value, 4) = "3456" Then cell.Offset(0, -1) =
If Left(cell.Value, 4) = "4567" Then cell.Offset(0, -1) =
Next
End Sub
Hope someone can help, many thanks in advance.