LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofilling INPUTBOX

I am using the Macro shown below to search of certain items then
Highlight tham in Yellow.
When I run the macro it prompts me for the data I am searching for
them works perfectly.
The items I am looking for are always the same. Is there some way to
supply the names within the Macro rather than looping running the
Macro, entering the item, rerunning the macro, enetering the next
item...etc. It has been a very long time since I have done any
programming and I just don't recall how to do this.

Thanks in advance.

Rick
6821065raa




Sub FindHiLight()
Dim MyFind As Variant
Dim MyNewValue As Variant
Dim FoundCell As Object
Dim Counter As Long
'-------------------------------------------------
'- SET SEARCH KEY
MyFind = InputBox("Please insert value to find.")
If MyFind = "" Then End
Counter = 0
'------------------------------------------------
'- FIND ALL MATCHING CELLS
On Error Resume Next
Set ws = ActiveSheet
Set FoundCell = ws.Cells.Find(what:=MyFind)
If Not FoundCell Is Nothing Then
FirstAddress = FoundCell.Address
Do
Counter = Counter + 1
'--------------------------------------------
'- what to do if found
FoundCell.Interior.ColorIndex = 6
'--------------------------------------------
Set FoundCell = ws.Cells.FindNext(FoundCell)
Loop While Not FoundCell Is Nothing _
And FoundCell.Address < FirstAddress
End If
rsp = MsgBox("Found" & Counter)
End Sub

 
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
Autofilling Macro Bob F[_2_] Excel Programming 6 September 11th 06 07:16 PM
Help with autofilling formulas moncara New Users to Excel 1 June 21st 06 11:42 PM
Autofilling information sujomo Excel Worksheet Functions 0 February 15th 06 10:31 PM
autofilling cells Tim Excel Worksheet Functions 1 February 4th 05 11:10 PM
Autofilling from one sheet to another Gabe Excel Programming 0 September 29th 04 12:04 AM


All times are GMT +1. The time now is 12:35 PM.

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"