+ Reply to Thread
Results 1 to 4 of 4

Highlighting row and column of active cell (Excel 2010)

  1. #1
    Registered User
    Join Date
    12-15-2011
    Location
    Berkshire
    MS-Off Ver
    Excel 2010
    Posts
    13

    Question Highlighting row and column of active cell (Excel 2010)

    I have the following VBA code which does work but am trying to work out how I would make the active cell chosen a different colour to the row and column highlighting, so people can see clearly what cell they have chosen.

    Also does anyone know how I could limit the highlighting to show to the left and above the cell selected (my spreadsheet has conditional formatting on other items in the spreadsheet too in case that would have an effect on the code)

    I've also just noticed that when I've saved as a Macro Enabled Workbook, when I open it back up the VBA code isnt working - Help !

    Thanks

    Smiffy

    Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
    'Update 20140318
    Static xRow
    Static xColumn
    If xColumn <> "" Then
    With Columns(xColumn).Interior
    .ColorIndex = xlNone
    End With
    With Rows(xRow).Interior
    .ColorIndex = xlNone
    End With
    End If
    pRow = Selection.Row
    pColumn = Selection.Column
    xRow = pRow
    xColumn = pColumn
    With Columns(pColumn).Interior
    .ColorIndex = 6
    .Pattern = xlSolid
    End With
    With Rows(pRow).Interior
    .ColorIndex = 6
    .Pattern = xlSolid
    End With
    End Sub
    Last edited by Smiffy3594; 06-25-2015 at 10:09 AM. Reason: additional issue

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Highlighting row and column of active cell (Excel 2010)

    Try this one:

    Please Login or Register  to view this content.
    The code belongs in the sheet code, not a normal module, which I assume you know... I'm not sure why it is not working after you start back up, maybe if you upload the workbook we can investigate.
    Last edited by Arkadi; 06-25-2015 at 10:28 AM.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    12-15-2011
    Location
    Berkshire
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Highlighting row and column of active cell (Excel 2010)

    Arkadi you rock it works WOO HOO

    one more question when I open the file it remembers the last selection made when saving last, so when I choose a new one on re-opening it still highlights the previous row and column unless I click on the old active cell. Any thought on how to get around that so the workbook opens with nothing highlighted ?

    I tired to do a screenshot but the forum wont let me past an image

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Highlighting row and column of active cell (Excel 2010)

    Yeah, like the sheet events, there are workbook events too, so paste this in "ThisWorkbook", just update sheetname to the name of the sheet in question.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Print current page with active cell with VBA code Excel 2010
    By ruznemat in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-12-2017, 08:42 AM
  2. Highlighting Active Cell/Column/Row Problem
    By Statto in forum Excel General
    Replies: 1
    Last Post: 10-18-2014, 12:08 PM
  3. Excel 2010 VBA to Perform VLOOKUP Using Specific Cell in Active Row
    By excelforumkeys in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-28-2014, 01:32 PM
  4. Highlighting duplicate values in a column in conjunction with active cell
    By Brontosaurus in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-03-2014, 01:11 PM
  5. Active Row + Additional Cell Ranges. Excel 2010
    By sravilob in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-29-2012, 07:42 PM

Tags for this Thread

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