Saltysteve
New Member
- Joined
- Jul 23, 2014
- Messages
- 36
- Office Version
- 365
- Platform
- Windows
Hi all,
I have 2 columns of data contain ID numbers, which include text and numbers, although some are numbers only as follows
Sorry can't adjust the column width, so the numbers are way over there on the right.
I have tried VLOOKUP (using varying match types) , INDEX(MATCH) and VBA but none will work, I think because of the formatting issues. The following code does work when I swap some of the IDs to just numbers.
Sub Test()
'Declare variables
Dim c, d
Dim Calcs, Data As Worksheet
'Name variables
Set Data = Sheets("Sheet1")
Set Calcs = Sheets("Sheet2")
d = Data.UsedRange.Rows
c = Calcs.UsedRange.Rows
For i = 2 To UBound(c) 'Sets the row in the Calcs sheet
For ii = 2 To UBound(d) 'Sets the row in the Data sheet
If Calcs.Cells(i, 10) = Data.Cells(ii, 6) Then Calcs.Cells(i, 12).Value = Data.Cells(ii, 7)
Next ii
Next i
End Sub
Does anyone know a work around for this? Sheet 1 contains 4500 rows of data and Sheet 2, 350
Look forward to any help that can be offered.
I have 2 columns of data contain ID numbers, which include text and numbers, although some are numbers only as follows
d3856609 |
3b758509 |
3d758509 |
3758509 |
40194854 |
77ab49a9 |
5903c2ce |
Sorry can't adjust the column width, so the numbers are way over there on the right.
I have tried VLOOKUP (using varying match types) , INDEX(MATCH) and VBA but none will work, I think because of the formatting issues. The following code does work when I swap some of the IDs to just numbers.
Sub Test()
'Declare variables
Dim c, d
Dim Calcs, Data As Worksheet
'Name variables
Set Data = Sheets("Sheet1")
Set Calcs = Sheets("Sheet2")
d = Data.UsedRange.Rows
c = Calcs.UsedRange.Rows
For i = 2 To UBound(c) 'Sets the row in the Calcs sheet
For ii = 2 To UBound(d) 'Sets the row in the Data sheet
If Calcs.Cells(i, 10) = Data.Cells(ii, 6) Then Calcs.Cells(i, 12).Value = Data.Cells(ii, 7)
Next ii
Next i
End Sub
Does anyone know a work around for this? Sheet 1 contains 4500 rows of data and Sheet 2, 350
Look forward to any help that can be offered.