+ Reply to Thread
Results 1 to 3 of 3

Highlight doubleclicked cells of a specific range

Hybrid View

  1. #1
    Registered User
    Join Date
    06-02-2010
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2003
    Posts
    22

    Highlight doubleclicked cells of a specific range

    Hello,

    I have a program that allows for cells to be filled green then red and ten no fill for a given worksheet.(This occurs on doubleclick.) What I am trying to do is setup a way for the program to only be used for cells G2:Z1000.

    Any help is appreciated,
    Tay

    HTML Code: 
    Last edited by taya; 07-28-2010 at 04:41 PM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Highlight doubleclicked cells of a specific range

    One way perhaps:

    Private Sub worksheet_beforedoubleclick(ByVal Target As Range, cancel As Boolean)
        Dim lngColor As Long
        If Not Intersect(Target, Range("G2:Z1000")) Is Nothing Then
            With Target
                Select Case .Interior.ColorIndex
                    Case -4142
                        lngColor = 4
                    Case 3
                        lngColor = -4142
                    Case 4
                        lngColor = 3
                End Select
                .Interior.ColorIndex = lngColor
            End With
            Cancel = True
        End If
    End Sub

  3. #3
    Registered User
    Join Date
    06-02-2010
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Highlight doubleclicked cells of a specific range

    DonkeyOte,

    That worked perfectly!

    Thank you for the help,
    Tay

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1