Thread: Newbie question
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Newbie question

Sub TurnRed()
Dim sh As Worksheet
Dim rng As Range
Dim res As Variant
If LCase(ActiveSheet.Name) < "master" Then Exit Sub
If ActiveCell.Column < 1 Then Exit Sub
Cells.Font.ColorIndex = xlAutomatic
ActiveCell.EntireRow.Font.ColorIndex = 3
On Error Resume Next
Set sh = Worksheets(Cells(ActiveCell, 4))
On Error GoTo 0
If sh Is Nothing Then
MsgBox "Error, invalid sheet name"
Exit Sub
End If
With sh
Set rng = sh.Range(sh.Cells(1, 1), .Cells(Rows.Count, 1).End(xlUp))
End With
res = Application.Match(ActiveCell, rng, 0)
If Not IsError(res) Then
sh.Cells.Font.ColorIndex = xlAutomatic
rng(res).EntireRow.Font.ColorIndex = 3
' Application.Goto rng, True
Else
MsgBox "Not found"
End If
End Sub

Put this in a general module and assign to a button from the forms toolbar.

--
Regards,
Tom Ogilvy




"EdL " wrote in message
...
I'm new to vba programming and am basically looking to do the
following:

I am trying to keep track of football players for a fantasy football
draft. I have one sheet (master) with every football player listed
alphabetically (columns 1-2), a unique number (column 3) and position
they play (rb, wr, k, qb in column4).

In seperate worksheets named rb, wr, k, qb I have only those players
who play that position.

What I am looking to do is this: when I am on "master" sheet, I want
to be able to activate macro to change the font to red for the active
row, check column 4 for the position they play, activate the sheet
found in column 4, find the correct row (by matching my unique number
in column 3) and turn this row red.

I would appreciate any thoughts.

Thanks.


---
Message posted from http://www.ExcelForum.com/