View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default FIND-COPY DIFFERENT WORDS WITH MACRO

hi
I did this years ago but i forgot how i did it so i re-invented the wheel. I
don't remember it being this wordy. you may have to change somewhat to fit
your data but it should give you the idea.

Sub findsomthing()
Dim r1 As Range
Dim r2 As Range
Dim b As Range
Dim s As String
s = InputBox("enter something to find")
Set r1 = Range("A2")
Do While Not IsEmpty(r1)
Set r2 = r1.Offset(1, 0)
If r1.Value = s Then
r1.Select
Set b = r1
Exit Do
End If
Set r1 = r2
Loop
Do While Not IsEmpty(r1)
Set r2 = r1.Offset(1, 0)
If r1.Value = s Then
Range(b, r1).Select
End If
Set r1 = r2
Loop
Selection.Copy
End Sub

Post back it questions
Regards
FSt1

"Spiros" wrote:

Hi,

I am trying to create a macro that will find the word "MONDAY" in column A,
then copy "MONDAY" (in every cell down to column A) and stop when it will
find the word "TUESDAY" and so on.
Can someone help me with this?
Thanks for your help!!!
Spyros