Results 1 to 5 of 5

Extending a Private Sub Worksheet?

Threaded View

  1. #1
    Registered User
    Join Date
    10-04-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2003
    Posts
    12

    Post Extending a Private Sub Worksheet?

    Hi Guys,

    First I would like to thank you in advance- I know what a help this forum is and it has come to my rescue more times than I have had hot baths.

    I am trying to use a macro on my excel sheet. And that lies my problem as I am relatively inexperienced with VBA.

    My question- I have used a macro from this site http://excel.tips.net/T003283_Hiding...ell_Value.html) and adapted it for my sheet. See below)


    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        If Range("D1").Value = 0 Then
            Columns("H:Q").EntireColumn.Hidden = True
        Else
            Columns("H:Q").EntireColumn.Hidden = False
        End If
    End Sub
    I would like to add another instance of this (see below)

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        If Range("R1").Value = 0 Then
            Columns("S:V").EntireColumn.Hidden = True
        Else
            Columns("S:V").EntireColumn.Hidden = False
        End If
    End Sub
    But when I paste it below it - it wont work?

    Apologies for being ultra new!

    Thanks in advance

    Hernan
    Last edited by Richard Buttrey; 10-18-2012 at 09:33 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