View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jodie Jodie is offline
external usenet poster
 
Posts: 72
Default Macro to highlight a specified row

Thank you all, Gentlemen. These all look as though they will work. I will
try each of them to see which works best for my project.

If any of you are up for another one, I also need to write a macro which
will subtract the amount in column N of the row which contains "Guaranteed"
in column B, from the amount that is in column N of the row which contains
"Total" in column A. For example, I have spreadsheets that have fund names
in column B. In Column N there is a total dollar amount invested in the
corresponding fund. I need to back out the amount of funds in the Guaranteed
from the total of all funds. Each spreadsheet may have different funds and
some may not have Guaranteed at all. I would like the results to populate in
column N, directly under the Total row. Can any of you help?
--
Thank you, Jodie


"Per Jessen" wrote:

Hi Jodie

Assuming you have headers in row 1, we can use autofilter like this:

Sub Highlight()
Dim sh As Worksheet
On Error Resume Next
For Each sh In ThisWorkbook.Sheets
With sh
LastRow = .Range("B" & Rows.Count).End(xlUp).Row
.Range("B1:B" & LastRow).AutoFilter field:=1,
Criteria1:="Gauranteed"
If Err.Number 0 Then
Err.Clear
Else
.Range("B2:B" & LastRow).SpecialCells(xlCellTypeVisible).
_
EntireRow.Interior.ColorIndex = 6
.Columns("B").AutoFilter
End If
End With
Next
End Sub

Regards,
Per

On 11 Jan., 21:51, Jodie wrote:
How would I write a macro to find "Gauranteed" in any cell in Column "B" and
then highlight that row? Also, this would be for an entire workbook.
--
Thank you, Jodie


.