Hawaiin punch
New Member
- Joined
- Mar 8, 2010
- Messages
- 3
Hi
I have a Column A of mixed up names (the mix sometimes contains long codes), eg.
1234_treadmill*
b812 bicycle
ops+keyboard
rf_treadmill-
b812 bicycle_87
ops bicycle_&*
mouse et.<33>
And I have a Column B of simple names, eg.
treadmill
bicycle
keyboard
mouse
I want a macro to go through Column A and search for every value that can be found in Column B, and return the simple name in Column C for every relevant row in Column A. eg.
C
treadmill
bicycle
keyboard
treadmill
bicycle
bicycle
mouse
So far, I have a macro but it gets stuck on the 2nd loop and it also does not return the simple name on relevant row in column A... HELP!
Sub ReturnName()
Dim rngeFound As Range, rngeSearchRange As Range
Dim ref As Variant
Dim i As Variant
Set rngeSearchRange = ActiveSheet.Range("b4:b700")
Set ref = Range("b4")
Set rngeFound = rngeSearchRange.Find(ref)
Do
For Each i In Range("C4:C700")
i.Value = ref
'i = ActiveCell.Offset(1, 0).Select
'i = ref
ref = ref.Offset(1, 0)
Next i
Loop
Your help is much appreciated....
Thanks.
I have a Column A of mixed up names (the mix sometimes contains long codes), eg.
1234_treadmill*
b812 bicycle
ops+keyboard
rf_treadmill-
b812 bicycle_87
ops bicycle_&*
mouse et.<33>
And I have a Column B of simple names, eg.
treadmill
bicycle
keyboard
mouse
I want a macro to go through Column A and search for every value that can be found in Column B, and return the simple name in Column C for every relevant row in Column A. eg.
C
treadmill
bicycle
keyboard
treadmill
bicycle
bicycle
mouse
So far, I have a macro but it gets stuck on the 2nd loop and it also does not return the simple name on relevant row in column A... HELP!
Sub ReturnName()
Dim rngeFound As Range, rngeSearchRange As Range
Dim ref As Variant
Dim i As Variant
Set rngeSearchRange = ActiveSheet.Range("b4:b700")
Set ref = Range("b4")
Set rngeFound = rngeSearchRange.Find(ref)
Do
For Each i In Range("C4:C700")
i.Value = ref
'i = ActiveCell.Offset(1, 0).Select
'i = ref
ref = ref.Offset(1, 0)
Next i
Loop
Your help is much appreciated....
Thanks.