+ Reply to Thread
Results 1 to 4 of 4

Highlight Entire Row & Column

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    05-14-2010
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    155

    Highlight Entire Row & Column

    Dear Experts,

    I am working on a huge excel workbook and I need that if select any cell for entry or edit entire row and column should highlight so that I can't make wrong entry.
    Like if I am working in Cell AN302, so AN column and 302 row should highlight.

    Please guide me on this issue.


    Thanks in advance.
    Rajeev Kumar

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Highlight Entire Row & Column

    Right Click on your Sheet Tab --> View Code --> Paste the code given below in the opened code window --> Close the VBA Editor --> Save your workbook as Excel Macro-Enabled Workbook --> It's done.
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        Cells.Interior.ColorIndex = 0
        Cells.Borders.LineStyle = xlNone
        Union(Target.EntireRow, Target.EntireColumn).Interior.ColorIndex = 6
        Target.EntireColumn.BorderAround xlContinuous, xlThin
        Target.EntireRow.Cells.BorderAround xlContinuous, xlThin
    End Sub
    Does this help?
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Forum Contributor
    Join Date
    05-14-2010
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    155

    Re: Highlight Entire Row & Column

    Hi SKTNEER,
    Its working as per my requirement.

    Only some issues that is it possible that: -
    1) My format as border should not remove
    2) It will highlight only Working area (not upto end)

    If it can be please do.

    Thanks alot.

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Highlight Entire Row & Column

    Change the earlier code to this......
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim lr, lc As Long
    lr = Cells(Rows.Count, 1).End(xlUp).Row
    lc = Cells(1, Columns.Count).End(xlToLeft).Column
        Cells.Interior.ColorIndex = 0
        Union(Range(Cells(Target.Row, 1), Cells(Target.Row, lc)), Range(Cells(1, Target.Column), Cells(lr, Target.Column))).Interior.ColorIndex = 6
    End Sub

+ 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. [SOLVED] how to highlight the entire column in a sheet
    By catchnanan in forum Excel General
    Replies: 10
    Last Post: 07-10-2013, 03:08 PM
  2. Replies: 5
    Last Post: 03-18-2011, 03:32 PM
  3. Highlight entire row based on value in a column c
    By ramky79 in forum Excel General
    Replies: 3
    Last Post: 10-27-2010, 01:40 PM
  4. Replies: 1
    Last Post: 07-19-2006, 09:40 AM
  5. A Crosshair to Highlight the Entire Row/Column Prior to active cel
    By Josh Lakien in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-31-2005, 10:05 AM

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