Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can you Lookup/Match then copy formating?
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can you Lookup/Match then copy formating?
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can you Lookup/Match then copy formating?
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can you Lookup/Match then copy formating?
This is great...
And what about font color? "Rowan" wrote: 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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can you Lookup/Match then copy formating?
I tried adding:
With Target.Interior .ColorIndex = fRng.Interior.ColorIndex .Pattern = fRng.Interior.Pattern .PatternColorIndex = fRng.Interior.PatternColorIndex .Font.Color = fRng.Font.Color End With but that did NOT do it... ;-( "Rowan" wrote: 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 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can you Lookup/Match then copy formating?
That is because .Font isn't a property of interior. It is a property of the
range. -- Regards, Tom Ogilvy "CRayF" wrote in message ... I tried adding: With Target.Interior .ColorIndex = fRng.Interior.ColorIndex .Pattern = fRng.Interior.Pattern .PatternColorIndex = fRng.Interior.PatternColorIndex .Font.Color = fRng.Font.Color End With but that did NOT do it... ;-( "Rowan" wrote: 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 |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can you Lookup/Match then copy formating?
With Target.Interior
.ColorIndex = fRng.Interior.ColorIndex .Pattern = fRng.Interior.Pattern .PatternColorIndex = fRng.Interior.PatternColorIndex End With Target.Font.colorindex = fRng.font.colorindex Although another take on this might be to copy and pastespecial the formats from one cell to the other so: 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 fRng.Copy Target.PasteSpecial Paste:=xlPasteFormats Application.CutCopyMode = False End If End If End If ErrorHandler: Application.EnableEvents = True End Sub CRayF wrote: I tried adding: With Target.Interior .ColorIndex = fRng.Interior.ColorIndex .Pattern = fRng.Interior.Pattern .PatternColorIndex = fRng.Interior.PatternColorIndex .Font.Color = fRng.Font.Color End With but that did NOT do it... ;-( "Rowan" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Lookup Formula: Return 1st match, then 2nd match, then 3rd match | Excel Discussion (Misc queries) | |||
Conditional formating, match, lookups | Excel Worksheet Functions | |||
Lookup? Match? pulling rows from one spreadsheet to match a text f | Excel Worksheet Functions | |||
Lookup and conditional formating | Excel Worksheet Functions | |||
Copy Rows if Lookup Criteria Match | Excel Discussion (Misc queries) |