+ Reply to Thread
Results 1 to 5 of 5

worksheet change event - my code isnt working

  1. #1
    Forum Contributor
    Join Date
    11-22-2006
    MS-Off Ver
    2010
    Posts
    201

    worksheet change event - my code isnt working

    Hi,

    i have a worksheet called "report" and in cell D4 the value is based on the results of a validation list in sheet "selection" cell A5.

    When the "report" worksheet is selected i would like it to run a macro similar to my attempt below. So if cell D1 has a value of "version 1" then it will run the line: ActiveSheet.Range("A9:A39").Rows.Hidden = False

    Please Login or Register  to view this content.

    thanks all.
    Last edited by tinkerbelle; 06-17-2010 at 07:15 AM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: worksheet change event - my code isnt working

    Saying your code isn't working is not terribly helpful. What is not working? What should it be doing that it isn't, or vice versa?

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: worksheet change event - my code isnt working

    If by D4 you mean D1 (as per your code) then the Change event won't fire as and when a formula result updates.

    Either

    a) switch from Change to Calculate event (though you're then open to the event firing more often than is necessary)

    b) apply the Change event against the sheet containing the original Data Validation list (ie the "prime mover")
    in turn modify the remaining code such that it is applied to the relevant sheet object rather than the ActiveSheet

  4. #4
    Forum Contributor
    Join Date
    11-22-2006
    MS-Off Ver
    2010
    Posts
    201

    Re: worksheet change event - my code isnt working

    Fair point.

    Not to worry, i have figured it out myself by changing to a worksheet_activate event.

  5. #5
    Forum Contributor
    Join Date
    11-22-2006
    MS-Off Ver
    2010
    Posts
    201

    Re: worksheet change event - my code isnt working

    Thanke DonkeyOte, as you can see from my reply i have managed to adapt my code and it now works.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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