View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.newusers
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Macro to copy text between two different delimeters

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
--
Gary''s Student - gsnu200713


" wrote:

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