ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   selecting columns and a loop (https://www.excelbanter.com/excel-programming/338202-selecting-columns-loop.html)

John

selecting columns and a loop
 
I have the following code with which I want to highlight new entries to my
spreadsheet. The new entries are marked "new" in column A. I am testing
some code and cannot remember/figure out how to select the range I would like
to add color too. I want to highlight the active row and select up to column
Z and fill in a color. Here is the code, which starts what I want to do but
doesn't quite bring it home...

a second question would be: Will this code work with more than one sheet if
I select a new sheet?

Sheets("c").Select
Set wks = ActiveSheet
Set rngToSearch = wks.Columns(1)

Set rngFound = rngToSearch.Find("new")
If rngFound Is Nothing Then
MsgBox "Nope"
Else
Do
rngFound.Select
???????????????????????
Range(ActiveCell, Columns.End(xlLeft)).Select ???
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With

Set rngFound = rngToSearch.FindNext
Loop Until rngFound Is Nothing
End If
End Sub


All times are GMT +1. The time now is 01:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com