Question

  • Creator
    Topic
  • #2143180

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

    by clive306 ·

    Tags: 

    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

You are posting a reply to: EXCEL, Cell background colour change over sheets – skip x number of rows

The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our Community FAQs for details. All submitted content is subject to our Terms of Use.

All Answers

Share your knowledge