View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rowan[_9_] Rowan[_9_] is offline
external usenet poster
 
Posts: 88
Default Can you Lookup/Match then copy formating?

Try:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrorHandler
Application.EnableEvents = False
Dim fRng As Range
If Target.Count = 1 Then
Set fRng = Intersect(Target, Range("S16:S19"))
If Not fRng Is Nothing Then
Set fRng = Nothing
With Range("AC12:AC19")
Set fRng = .Find(Target.Value)
End With
If Not fRng Is Nothing Then
With Target.Interior
.ColorIndex = fRng.Interior.ColorIndex
.Pattern = fRng.Interior.Pattern
.PatternColorIndex = fRng.Interior.PatternColorIndex
End With
End If
End If
End If

ErrorHandler:
Application.EnableEvents = True
End Sub


Regards
Rowan

CRayF wrote:
Almost there... this copied the background pattern only. Can I also send
over the Pattern Option (lines/dots) as well as the font color?

"Rowan" wrote:


Maybe like this:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrorHandler
Application.EnableEvents = False
Dim fRng As Range
If Target.Count = 1 Then
Set fRng = Intersect(Target, Range("S16:S19"))
If Not fRng Is Nothing Then
Set fRng = Nothing
With Range("AC12:AC19")
Set fRng = .Find(Target.Value)
End With
If Not fRng Is Nothing Then
Target.Interior.ColorIndex = fRng.Interior.ColorIndex
End If
End If
End If

ErrorHandler:
Application.EnableEvents = True
End Sub

Regards
Rowan

CRayF wrote:

I have 4 Cells which are indented to be User Picks of racer numbers between
1-8:
S16
S17
S18
S19

In the AC Cells each holds the racer number 1-8 (below) and is FOTMATED
(which include some Patten shading) to match the Racer Colors.
AC12 = 1
AC13 = 2
AC14 = 3
..
AC19 = 8

Within this sub() I would like to know is I could take the number entered in
the Cells S16-S19, and lookup up the value to match a Cell in AC12:AC19. Once
matched, change the User Picked Racer in the S Cell to match for FORMAT of
the matching AC Cell.

Also, I would not want to overlay the formula so that if the User changed
the Racer number again, it would change to match again.

I already have code set up to detect change