![]() |
FIND-COPY DIFFERENT WORDS WITH MACRO
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 |
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 |
All times are GMT +1. The time now is 12:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com