LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Help! Basic Macro Question?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Very basic VBA question. Cerberus Excel Discussion (Misc queries) 1 July 21st 08 04:30 PM
Basic question...sorry jen the runner Excel Worksheet Functions 11 September 18th 07 12:12 AM
Basic VBA question... mattsvai[_7_] Excel Programming 8 February 3rd 06 07:53 PM
Very basic macro question. Fn0rd Excel Programming 3 November 28th 03 11:22 AM
Too Basic A Question dave Excel Programming 6 October 26th 03 03:57 PM


All times are GMT +1. The time now is 05:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"