Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
hme hme is offline
external usenet poster
 
Posts: 1
Default Auto find a specific row and copy it to another worksheet


Hi

let me explain more clear

how can excel find automatically a given text in all worksheets (i
there is any) of a given workbook and copy the row where this text i
to another worksheet.

should be easy but I can't

sohrab hashem

--
hm
-----------------------------------------------------------------------
hme's Profile: http://www.excelforum.com/member.php...fo&userid=1593
View this thread: http://www.excelforum.com/showthread.php?threadid=27415

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Auto find a specific row and copy it to another worksheet

Assume we will copy to Sheet2 (so don't search that sheet)


Sub CopyInfo()
Dim sh as Worksheet, rng as Range
for each sh in worksheets
if lcase(sh.name) < "sheet2" then
set rng = sh.Cells.Find("textString")
if not rng is nothing then
rng.EntireRow.copy Destination:= _
worksheets("Sheet2").Cells(rows.count,1).End(xlup) (2)
exit sub
end if
end if
Next
msgbox "TextString not found"
End Sub

Find has many arguments which correspond to choices in the Edit=Find
dialog. Some of these arguments are persistent and could affect the outcome
of the find command. It is usually safer to specify them all explicitely.
You can turn on the macro recorder and do an Edit=Find to get code that
shows how to set them all and then look in the Excel VBA help file for an
explanation of each along with alternate values for the arguments.

--
Regards,
Tom Ogilvy




"hme" wrote in message
...

Hi

let me explain more clear

how can excel find automatically a given text in all worksheets (if
there is any) of a given workbook and copy the row where this text is
to another worksheet.

should be easy but I can't

sohrab hashemi


--
hme
------------------------------------------------------------------------
hme's Profile:

http://www.excelforum.com/member.php...o&userid=15930
View this thread: http://www.excelforum.com/showthread...hreadid=274152



Reply
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
How do I find and copy rows based on specific criteria? Georgew New Users to Excel 3 May 29th 09 11:07 AM
specific worksheet protection and auto run Josh Excel Discussion (Misc queries) 11 October 12th 07 05:47 AM
find a specific cell from the entire worksheet CINDY Excel Worksheet Functions 1 November 15th 06 05:55 AM
How do I copy specific items to another worksheet? HEATHERCOX Excel Worksheet Functions 1 February 28th 05 02:00 PM
How Do I Find A Specific Worksheet Chris N Excel Discussion (Misc queries) 1 December 27th 04 06:53 PM


All times are GMT +1. The time now is 06:16 PM.

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

About Us

"It's about Microsoft Excel"