+ Reply to Thread
Results 1 to 6 of 6

worksheet change event only when certain cell changes

  1. #1
    Registered User
    Join Date
    09-13-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    49

    worksheet change event only when certain cell changes

    Dear all,

    I have a spreadsheet in which I need several rows to become hidden, dependent on the value in cell L3 (which is chosen from a drop-down list).
    I've been searching here and found several topics on worksheet change events, which helped me to get to the following:

    Please Login or Register  to view this content.
    note:in the original code I have in my worksheet, "...etc" is a list running up to row 711. But I didn't want to 'bore' you with he whole list.

    This does what I need it to do with one small 'bug': it fires every time any cell in the worksheet is adjusted and I need it to fire only if cell L3 is adjusted.
    Haven't been able yet to figure out how to do that , so....any suggestions are very welcome.

    Thanks in advance.
    Thirsa

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: worksheet change event only when certain cell changes

    I guess you have a drop down items in L3. The code is fired if any values in L3 are changed.

  3. #3
    Registered User
    Join Date
    09-13-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: worksheet change event only when certain cell changes

    As I said, I do indeed have a drop-down in L3 and a change in the selection in this list should trigger the code.
    And it does.
    But with the code as it is now, so does every other change in every other cell of the worksheet.
    And that's annoying (to say the least ) and very impractical, so that's what I'm trying to solve.

  4. #4
    Registered User
    Join Date
    09-13-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: worksheet change event only when certain cell changes

    Just a quick thought that occurred to me just now: Could the problem have something to do with the fact that by default, L3 is not empty but set to - ?

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: worksheet change event only when certain cell changes

    This line is the only point which the code could be fired on.

    Please Login or Register  to view this content.
    Do you have any other change events code, somewhere in your sheet?

    Check all the sheets in the workbook. Do you a code in this workbook?

    What is L3 is not empty but set to - ? ?

  6. #6
    Registered User
    Join Date
    09-13-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: worksheet change event only when certain cell changes

    It looks like I've solved the problem and the cause was not what I expected.

    Up to now, when I was making adjustments to the spreadsheet, I did that in the default lay-out, in which all rows are unhidden.
    Whenever I typed something in any random cell in the spreadsheet and hit enter, my selection changed to cell A8. So that made me think that the whole code fired.

    However, just now I tried the same thing, only with some of the rows hidden. And it turns out that only the cell-selection changed, but the hidden rows did not get unhidden.
    So it looks like I simply put
    Please Login or Register  to view this content.
    in the wrong place.

    I've adjusted my original code to:
    Please Login or Register  to view this content.
    And now, when I adjust something in a random cell, nothing else happens.

    Thanks again for thinking along.

+ 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. Worksheet Change Event based on value of a cell
    By ron2k_1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-26-2014, 01:01 PM
  2. [SOLVED] Worksheet Change Event - Multiple Cell Selection
    By mojo249 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-02-2012, 08:30 PM
  3. [SOLVED] Cell value change to trigger macro (worksheet change event?)
    By Neil Goldwasser in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-10-2006, 10:00 AM
  4. [SOLVED] change event on specific cell rather than worksheet
    By frendabrenda1 in forum Excel General
    Replies: 3
    Last Post: 09-20-2005, 10:05 AM
  5. Replies: 5
    Last Post: 06-23-2005, 06:05 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