Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 590
Default using a inputbox to enter search item, then find all highlight al.

I am trying to use an Inputbox to enter a search item, find all entries,
highlight all entries, then copy to another sheet using a macro.

Thank you for you help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default using a inputbox to enter search item, then find all highlight al.

Does it have to be a macro? You can do what you asked using Excel's Find
option. Click Edit/Find in XL2003 or earlier or
Home/Editing/Find&Select/Find in XL2007, type in the word you are searching
for (you can click the "Options" button to reveal more options for
controlling the search), click the "Find All" button and then press Ctrl+A
to select all the found cells. You can now close the dialog box (the
selected cells will remain selected) and do whatever you want with the
selected cells.

--
Rick (MVP - Excel)


"Ken" wrote in message
...
I am trying to use an Inputbox to enter a search item, find all entries,
highlight all entries, then copy to another sheet using a macro.

Thank you for you help.


  #3   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 590
Default using a inputbox to enter search item, then find all highlight

Rick, Thanks for responding
I do need to run it as a macro, I've tried capturing the steps using the
find command in excel and highlightling the rows everything looks fine but
when I run the macro it only copies the first cell.
Ken

"Rick Rothstein" wrote:

Does it have to be a macro? You can do what you asked using Excel's Find
option. Click Edit/Find in XL2003 or earlier or
Home/Editing/Find&Select/Find in XL2007, type in the word you are searching
for (you can click the "Options" button to reveal more options for
controlling the search), click the "Find All" button and then press Ctrl+A
to select all the found cells. You can now close the dialog box (the
selected cells will remain selected) and do whatever you want with the
selected cells.

--
Rick (MVP - Excel)


"Ken" wrote in message
...
I am trying to use an Inputbox to enter a search item, find all entries,
highlight all entries, then copy to another sheet using a macro.

Thank you for you help.


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default using a inputbox to enter search item, then find all highlight

Collect all the found cells then paste at one go.

Sub copy_found_Cells()
Dim Cell As Range, tempR As Range, rangeToCheck As Range
'check each cell in the selection
findall = InputBox("Enter a search word")
For Each Cell In Selection
If Cell.Value = findall Then
If tempR Is Nothing Then
'initialize tempR with the first qualifying cell
Set tempR = Cell
Else
'add additional cells to tempR
Set tempR = Union(tempR, Cell)
End If
End If
Next Cell
'display message and stop if no cells found
If tempR Is Nothing Then
MsgBox "There are no cells found " & _
"in the selected range."
End
End If
'select qualifying cells
tempR.Copy Destination:=Sheets("Sheet2").Range("A1")
End Sub


Gord Dibben MS Excel MVP

On Wed, 17 Feb 2010 15:37:01 -0800, Ken
wrote:

Rick, Thanks for responding
I do need to run it as a macro, I've tried capturing the steps using the
find command in excel and highlightling the rows everything looks fine but
when I run the macro it only copies the first cell.
Ken

"Rick Rothstein" wrote:

Does it have to be a macro? You can do what you asked using Excel's Find
option. Click Edit/Find in XL2003 or earlier or
Home/Editing/Find&Select/Find in XL2007, type in the word you are searching
for (you can click the "Options" button to reveal more options for
controlling the search), click the "Find All" button and then press Ctrl+A
to select all the found cells. You can now close the dialog box (the
selected cells will remain selected) and do whatever you want with the
selected cells.

--
Rick (MVP - Excel)


"Ken" wrote in message
...
I am trying to use an Inputbox to enter a search item, find all entries,
highlight all entries, then copy to another sheet using a macro.

Thank you for you help.


.


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
find all instances of a search item and put result in a single cel Art Excel Worksheet Functions 5 March 24th 10 12:46 AM
To find rate of each item from item.xls and to copy price.xls pol Excel Discussion (Misc queries) 7 July 16th 09 12:49 AM
Find rows with a common item and find or highlight difference jonnybrovo815 Excel Programming 2 February 27th 08 12:56 AM
Inputbox to enter a % StephanieH Excel Programming 3 April 10th 06 04:00 PM
Inputbox to enter date Tom Ogilvy Excel Programming 0 July 27th 04 05:44 PM


All times are GMT +1. The time now is 06:07 AM.

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"