Thread: Need VB help
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
StumpedAgain StumpedAgain is offline
external usenet poster
 
Posts: 192
Default Need VB help

Hey Eric,

I did the following on your example post and it works fine (unless I missed
something). Hope it helps!!

Sub ForEric()

Dim curselection As Range
Set curselection = Range("B2")

Do Until curselection = ""

If curselection Like curselection.Offset(1, 0) Then
curselection.EntireRow.Resize(2, 5).Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With

If curselection.Offset(0, 1) < curselection.Offset(1, 1) Then
curselection.Offset(0, 1).Resize(2, 1).Select
Selection.Font.ColorIndex = 3
Selection.Font.Bold = True
End If
End If

Set curselection = curselection.Offset(1, 0)

Loop

End Sub
--
-SA


"Eric @ BP-EVV" wrote:

I've got a spreadsheet that looks like the following:

location item weight type1 type2
A 1 5.50 M M
B 1 5.50 M M
A 2 6.60 M M
B 2 6.60 T M
A 3 7.00 M M
A 4 6.00 T M
B 4 6.00 M M
C 4 6.25 T M

What I need to do is this:

1. If item on row 1 = item on row 2, highlight both rows (or multiple rows
if the item exists in more than 2 locations)
2. If weight on row 1 < weight on row 2 (for same item at different
locations), change text color of weight cells to bolded-red
3. For all other conditions, leave formatting as is.

I'm stuck trying to figure out how to do that through VB code.....any
throughts ?

Thanks !