LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Conditional Formatting with reference to another worksheet VBA

I am trying to use conditional formating from input from a second
sheet.

The ranges are relative: offset by +5 vertically. I have tried the
code a few ways, but I cannot figure out how to translate the range
from one sheet to another.

Here is what I have:


Private Sub Worksheet_Change(ByVal RoadShow As Excel.Range)
Dim Source As Range
Dim Target As Range
Dim CellVal As Integer
Dim CellTar As Integer
Dim LastLoc As Range

If RoadShow.Cells.Count 1 Then Exit
If RoadShow = "" Or Not IsNumeric(RoadShow) Then Exit Sub
CellVal = RoadShow
LastLoc = RoadShow.Address

Set Target = Worksheets("Costco").Range(LastLoc)
Set Source = Range("C4:AB45")

If Not Intersect(RoadShow, Source) Is Nothing Then

Target.Offset(5, 0).Select
CelTar = Target.Interior.ColorIndex
If CellVal = 1 Then
Select Case CellTar
Case 27
With Target.Interior
.ColorIndex = 55
.Pattern = xlPatternVertical
.PatternColorIndex = 27
End With
Case 42
With Target.Interior
.ColorIndex = 55
.Pattern = xlPatternVertical
.PatternColorIndex = 42
End With
Case ""
Target.Interior.ColorIndex = 55
End Select
End If
End If
End Sub



Thank you for the help.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
conditional formatting = or cell reference + 2 Whitney Excel Discussion (Misc queries) 2 April 19th 10 08:10 PM
Conditional formatting offset reference IanC[_2_] Excel Worksheet Functions 3 February 17th 10 04:58 PM
reference another cell in conditional formatting Rose Excel Worksheet Functions 3 February 27th 09 09:17 PM
Reference to functions in Conditional Formatting Atreides Excel Programming 2 May 14th 08 03:45 AM
cell reference changes and conditional formatting Maggie Boby Excel Worksheet Functions 4 June 11th 06 04:43 AM


All times are GMT +1. The time now is 06:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"