#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Row 1

In this Macro, cells are highlighted, if occupied below Row 1 by Input.
Problem is: How do you color a cell in Row 1 with the same color as
these cells that occupied below Row 1.

And to leave Row 1 alone if there is no occupancy.
------------------------------------------------

Sub SearchWorkbook()
Dim Wksh As Worksheet
Dim FindString As String
Dim Msgtext As String

Msgtext = "The string was found; do you want to continue
searching?"
Prompt = "Enter the string to search for"
Title = "Find for All Sheets"

' Display the Input Box
On Error Resume Next

FindString = Application.InputBox(Prompt:=Prompt, _
Title:=Title, Type:=2) 'Text to find (string)


If FindString = "" Then
MsgBox "Canceled."
End 'exit the macro
End If


For Each Wksh In ActiveWorkbook.Worksheets(1)
With Worksheets(1).Range("B2:AX20")
Set c = .Find(FindString, LookIn:=xlValues, _
LookAt:=xlWhole, MatchCase:=False)
If Not c Is Nothing Then
firstAddress = c.Address
Wksh.Activate
Do
c.Interior.ColorIndex = 17
c.Select

Reply = MsgBox(Msgtext, vbYesNo, Title)
If Reply = vbNo Then End
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
Next
End Sub
--------------------------------------------------

With Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Row 1

Thanks!
Found solution

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



All times are GMT +1. The time now is 02:54 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"