Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Okay so I have been supplied this Sub (thanks Jim!) but I don't how to add
additional text strings to find within a range. Do I just add another string seperate by a comma. I tried that and it didn't work (got compile errors, I do not know if I type it in wrong somehow. Here it is: Public Sub CopyFoundStuff() Dim wksCopyTo As Worksheet Dim wksCopyFrom As Worksheet Dim rngToSearch As Range Dim rngFound As Range Dim rngFoundAll As Range Dim strFirstAddress As String Set wksCopyFrom = Sheets("Sheet1") Set rngToSearch = wksCopyFrom.Columns("C") Set rngFound = rngToSearch.Find(What:="firstTextString", _ LookIn:=xlFormulas, _ LookAt:=xlWhole, _ MatchCase:=False) If rngFound Is Nothing Then MsgBox "Sorry ""that text"" was not found." Else Set rngFoundAll = rngFound strFirstAddress = rngFound.Address Do Set rngFoundAll = Union(rngFound, rngFoundAll) Set rngFound = rngToSearch.FindNext(rngFound) Loop Until rngFound.Address = strFirstAddress Set wksCopyTo = Worksheets.Add rngFoundAll.EntireRow.Copy wksCopyTo.Range("A2") End If End Sub "John Hughes" wrote: I have a worksheet that has 5 columns with approx. 600 rows. I need to create a macro that finds in one of the columns a dozen or so strings of text. I need to then take those rows that include each cell (containing the string) and send that info (row of 5 cells) via email along with a pre-determined text message. I can figure out how to set up Outlook to do a mailmerge from MS Word, but I need help to speed up my learning cure of macros so that I can actually do my work. What keywords should I be searching for in the development of this macro - or better yet - does anyone have something close to help me? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Very basic VBA question. | Excel Discussion (Misc queries) | |||
Basic question...sorry | Excel Worksheet Functions | |||
Basic VBA question... | Excel Programming | |||
Very basic macro question. | Excel Programming | |||
Too Basic A Question | Excel Programming |