Macro to copy text between two different delimeters

V

vdossey

I am trying to write a macro in Excel to select text between cells
which contain words.

Two challenges:
1.) I need to search for a cell that contains only one-single word
"item:" and then copy the contents of the cell just-above that cell
2.) I need to search for a cell that contains only one-single word
"component(s):" and then copy all of the rows below that until I find
a cell that contains only the word "Zip"

Any samples would help for either of these challenges
~Vic
 
G

Guest

This is just an example of technique, not a full solution. This macro
searches the active worksheet fin any region you have Selected. If it finds
"item:" it copies the contents of the cell directly above to Sheet2 cell A1:

Sub dossey()
Set rDest = Sheets("Sheet2").Range("A1")
For Each r In Selection
If r.Value = "item:" Then
r.Offset(-1, 0).Copy rDest
Exit Sub
End If
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top