Results 1 to 2 of 2

Private Sub Worksheet_Change(ByVal Target As Range)

Threaded View

  1. #1
    Registered User
    Join Date
    06-13-2013
    Location
    Charleston, SC
    MS-Off Ver
    Excel 2010
    Posts
    75

    Private Sub Worksheet_Change(ByVal Target As Range)

    [Solved]

    [I created a drop down list and defaulted it to No. If the value is Y, it unhides the cells. I also had to add code for unprotecting/protecting sheet since it was protected.]
    **********************
    I cannot get this code to work.

    What I want to do is to have rows 35-36, 40-41 and 45-46 unhidden when age is 50 or greater. By default on my inputs screen I have these rows hidden.
    I have an inputs screen on my workbook and I use a "reset inputs" macro so the cell for calculated age has to be referenced.

    cell b5= date of birth
    Cell b6=by13 and cell b6 is protected since it is a calculated age
    Cell BX13 = year(b5)
    Cell BY13 =IF(YEAR(BW13)-BX13>100,0,YEAR(BW13)-BX13)

    This code does not "unhide" my rows 35-36, 40-41 and 45-46 when calculated age is 50 or greater. Note, I need to combine it with the other code for b19 which already worked.

    Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Target.Address(0, 0) = "BY6" Then
        If Target.Value > "49" Then Rows("35:36,40:41,45:46").EntireRow.Hidden = False
    End If
    If Target.Address(0, 0) = "B19" Then
        If Target.Value = "" Then Range("B20:B23").ClearContents
    End If
    End Sub

    Thanks
    Hank
    Last edited by hmr2662; 06-25-2015 at 10:22 AM. Reason: solved

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Private Sub Worksheet_Change(ByVal Target As Range)
    By BigJim68 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-27-2014, 01:57 PM
  2. [SOLVED] Private Sub Worksheet_Change(ByVal Target As Range) End Sub
    By kanonathena in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-10-2013, 12:25 AM
  3. [SOLVED] Private Sub Worksheet_Change(ByVal Target As Range)
    By Hilton1982 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-18-2012, 01:13 AM
  4. [SOLVED] Private Sub Worksheet_Change(ByVal Target As Range)
    By Arturo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-25-2005, 11:06 AM
  5. Private Sub Worksheet_Change(ByVal Target As Range)
    By bondcrash in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-11-2005, 02:59 PM

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