Find partial string and then paste whole cell contents as an offset to another 'searched for' string

jblonde002

Board Regular
Joined
Jun 10, 2014
Messages
61
I know that's title gore and I am sorry - that was my best effort!

I need some VBA to help search for the word "Qualification" which will always be found ONCE in column A.
Once found I need to copy the whole cell contents and paste it to the left of cell that contains the string "Name" (which will always be found in column B). So far I have managed the below:

Code:
    Dim myRange As Range    Dim myCell As Range
    Set myRange = Range("A1:A100")
    For Each myCell In myRange
    If myCell Like "*Qualification*" Then
    myCell.Copy

The code I have above gets me as far as locating and copying the Qualification string from column A, but I can't work out how to then paste this it one cell to the left of the cell that contains the word "Name" in column B. Sorry for poor explanation, hopefully someone can still help!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Try:
Code:
Sub CopyCell()
    Dim qual As Range, name As Range
    Set qual = Range("A:A").Find("Qualification", LookIn:=xlValues, lookat:=xlPart)
    Set name = Range("B:B").Find("Name", LookIn:=xlValues, lookat:=xlWhole)
    name.Offset(0, -1) = qual
End Sub
 
Upvote 0
That's hilarious, you managed to make my half completed effort, finish it to make it work and make it shorter :rofl:

Thanks so much - it works perfectly and I am very grateful!
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,270
Members
452,628
Latest member
dd2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top