Question

EXCEL, Cell background colour change over sheets - skip x number of rows

By clive306 ·
wanting to change the colour of a cell on sheet2 to match that on sheet1. the following code wor a macro works, but what i need now is for it to skip the first 44 rows on sheet2 before applying the backgroud colour selected in sheet1.

so row 45 sheet2 will match row1 sheet1 if that make sense?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim xSRg, xDRg, xISRg, xIDRg As Range
Dim xFNum As Long
On Error Resume Next
Set xSRg = Sheet1.Range("B1:D300")
Set xDRg = Sheet2.Range("B1:D300")
For xFNum = 1 To xSRg.Count
Set xISRg = xSRg.Item(xFNum)
Set xIDRg = xDRg.Item(xFNum)
xIDRg.Interior.Color = xISRg.Interior.Color
Next xFNum

End Sub


thanks in advance
0 total posts (Page 1 of 1)  
Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Software Forum
0 total posts (Page 1 of 1)  

Related Discussions

Related Forums