Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
Row 1
Thanks!
Found solution |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|