Results 1 to 6 of 6

Automattically adjust code when rows or columns are added

Threaded View

  1. #1
    Registered User
    Join Date
    03-13-2012
    Location
    WI, USA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Automattically adjust code when rows or columns are added

    Hi!

    I'm seeking to get the following; I have a code for when a checkbox is checked or unchecked; rows hide and unhide. However; when I add a row somewhere in the spreadsheet, the code doesn't automaticcaly adjust. I have the following code;

    Private Sub CheckBox4_Click()
    If CheckBox4.Value = True Then
        Range("65:65,47:54,67:70,82:93,96:116,118:119,125:131,134:138,146:147").Select
        Selection.EntireRow.Hidden = True
        Else
        Range("65:65,47:54,67:70,82:93,96:116,118:119,125:131,134:138,146:147").Select
        Selection.EntireRow.Hidden = False
        End If
    End Sub
    So when I add a row; row 47 becomes 48 for instance. This way the code hides the wrong cell!

    Does anybody have any ideas on how to make the code automatically adjust accordingly??

    Would be much appreciated!
    Last edited by Tulipo; 04-04-2012 at 08:24 AM.

Thread Information

Users Browsing this Thread

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

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