+ Reply to Thread
Results 1 to 68 of 68

Help to fix macro: hidding multiple rows

  1. #1
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Exclamation Help to fix macro: hidding multiple rows

    Hi All,

    I am using the following macro with success when there is just one range:
    Please Login or Register  to view this content.
    But I am struggling to hide the rolls if there is more than just one range, such as 1:10 and 21:236. I tried the below but it didn't work:
    Please Login or Register  to view this content.
    Any idea?

    Cheers,
    Last edited by ricdamiani; 04-14-2019 at 02:29 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Help to fix this macro please!

    Administrative Note:

    We would very much like to help you with your query, however the thread title does not really convey what your request is about. Please include the purpose of the macro.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Valued Forum Contributor dotchiejack's Avatar
    Join Date
    05-21-2015
    Location
    Antwerp,Belgium
    MS-Off Ver
    2016
    Posts
    507

    Re: Help to fix this macro please!

    Like this?
    Please Login or Register  to view this content.
    Click the * Add Reputation below to say thanks.

  4. #4
    Valued Forum Contributor dotchiejack's Avatar
    Join Date
    05-21-2015
    Location
    Antwerp,Belgium
    MS-Off Ver
    2016
    Posts
    507

    Re: Help to fix macro: hidding multiple rows

    @ AliGW,
    I hadn't seen your post when I answered the question.
    I wanted to delete the message, but I got an error message saying "Your message is to short.

  5. #5
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    Thanks mate, I already changed the title as requested by AliGW, but looks like it is still blocked?
    Any chance you could reply to the thread once more? Cheers
    Last edited by ricdamiani; 04-14-2019 at 04:12 AM.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Help to fix macro: hidding multiple rows

    It's unblocked now.

    Bear in mind (a) it's a Sunday, (b) all moderators are volunteers and therefore (c) I am not here 60/60/24/7.
    Last edited by AliGW; 04-14-2019 at 04:48 AM.

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    jindon your line works, but it also stop working the previous line:

    Please Login or Register  to view this content.
    How can I have both lines working? Thanks

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    Please Login or Register  to view this content.
    but Why 2 lines?
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    Sorry my line had a mistake. The first line was supposed to be k15 = CORRECT, the second line k15 = INCORRECT

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Help to fix macro: hidding multiple rows

    Can't you just use this?

    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    AliGW, please refer to the previous post. Correct code is:
    Please Login or Register  to view this content.

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Help to fix macro: hidding multiple rows

    Maybe you need IF THEN ELSE for this?

  14. #14
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    Should work
    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    Very strange jindon, the first line is working the opposite of the second. This is my real macro, exactly what I have in my spreadsheet:
    Please Login or Register  to view this content.
    The second line is working well, but the first line is hiding rows 21 to 27 and keeping all the other rows not hidden.

    Any idea?

  16. #16
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    As I said, why 2 lines?

    21:396
    1:20,28:396

    means 1:396

  17. #17
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Help to fix macro: hidding multiple rows

    Jindon - see post #8.

  18. #18
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    See post #15

  19. #19
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Help to fix macro: hidding multiple rows

    Read post #15 properly!!!

    Please Login or Register  to view this content.
    The values need to be different.

    That's why I asked if it needed IF THEN ELSE.

  20. #20
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    Sheets("Car Mileage").Rows("21:396").Hidden = [K15].Value = "METHODMONTHLY" - when I select the MONTHLY method in the cell K15, I will see only lines 1 to 20 which have the monthly structure, and all the other stuff between 21 to 396 should be hidden
    Sheets("Car Mileage").Range("a1:a20,a28:a396").EntireRow.Hidden = [K15].Value = "METHODYEARLY" - when I select the YEARLY method in the cell K15, I will see only lines 21 to 27 which have the yearly structure, and all the other stuff between 1 to 20, and 28 to 396 should be hidden

    Sorry for confusing you guys.

  21. #21
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    Then you don't seem to understand the logic.
    when [K15].Value = "METHODMONTHLY"
    hide
    Rows("21:396")

    UNHIDE
    Range("a1:a20,a28:a396").EntireRow

    and other way around when [K15].Value = "METHODYEARLY"

  22. #22
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Help to fix macro: hidding multiple rows

    Maybe not, but it's not working according to the OP. Perhaps if you give some explanations with your suggestions as a matter of course, it would help those of us less able in VBA to actually learn something.

    Over to you!

  23. #23
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    That was not for you.

  24. #24
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Help to fix macro: hidding multiple rows

    Then make your posts clear.

  25. #25
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    I made it clear, my post is just under the post form the OP.

    Can you please stop doing like this???

  26. #26
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Help to fix macro: hidding multiple rows

    Are you able to make the code do what the OP wants it to do? It seems that you and he are at cross purposes.

  27. #27
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    jindon I made the attached sample spreadsheet, you can see there is something not working properly. Could you please have a look please?

    As you said in your post before, I might not understand the logic and I am probably doing something wrong.

    Thanks for your help mate.

    Cheers,
    Attached Files Attached Files

  28. #28
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    Do you want it like this?

    How do you want if [K15] has no value?
    Please Login or Register  to view this content.
    Fixed a typo
    Last edited by jindon; 04-14-2019 at 07:30 AM.

  29. #29
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    It works well jindon, but what if I have many rows to be hidden with many different conditions? The code below I created before noticing the problem and therefore before creating this thread:
    Please Login or Register  to view this content.
    Sorry I thought the solution was going to be simple so that's why I just posted that two lines in my initial post.

    How can I adjust your macro from your latest post with so many conditions?

    Cheers,

  30. #30
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    OK, you make it hard for yourself, so let's think it other way around.

    Which row(s) do you want to UN hide with the condition(s)?

  31. #31
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    Yes, the macro works fine if there is just only range. The problems is 6 code lines have more than one range.

    Which rows I want to unhide? The opposite rows that need to be hidden
    For example, first line from my previous code, unhide 1:20. Second line, unhide 21 to 27. Third line, unhide from 28 to 36, and 38 onward. And so on...
    If you have the code, just send me for the first 3 lines and I can complete the rest.

    Cheers

  32. #32
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    Sucuri doesn't accept to post my code, so in the text file attached.
    Attached Files Attached Files

  33. #33
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    You are truly a legend and I am truly an annoying person: I forgot to mention that both "Car mileage" and "Income" tabs are password protect.
    Where should I insert these lines?
    Please Login or Register  to view this content.
    I think after that it would be all cover!

    Cheers,

  34. #34
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    Just one below and one above With and End With
    Please Login or Register  to view this content.
    And same for "Income" sheet.

  35. #35
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    Sorry to say but

    - Car Mileage bit of the macro doesn't seem to be working at all.
    - The Income part seems to be working besides the case K18.
    - I am also having trouble with this line: If Not IsNull(myVal) Then .Rows(myVal).Hidden = True. Is this line assuming a blank cell? The cell might be blank but not necessarily. Can this line be adjusted to "if the cells are different than NO, then show rows"?

    Cheers

  36. #36
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    It should not hide the row(s) when the value <> "NO".

    Anyway, I just coded based on your code, so I have no idea that it does.

  37. #37
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    Whoops..,
    Please Login or Register  to view this content.

  38. #38
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    Hi jindon,

    Unfortunately the code is not working, but I have made the attached sample spreadsheet and now you can see your code in action.

    I amended the code as per your previous post, but only cases E16 and E17 are working, all others are not.
    Also if you have all cases selected as "NO" in the Income tab, none of the rows should be showing, but this is not happening. Apparently the macro just works if selected one NO, if I select two NOs, just one of the NOs will hide the rows.

    In the sample spreadsheet, I colored the rows with different colors so you can better identify what should be hidden or not when selecting the options:
    - in the "Car mileage" tab, it should show only one color. A row might show more than a color, but that's fine as long as the main color is there.
    - in the "Income" tab, it should show only one color PER METHOD. A row might show more than a color, but that's fine as long as the main color is there.

    Please let me know if you can figure out what is happening with the code.

    Thanks jindon
    Attached Files Attached Files

  39. #39
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    Hi jindon, would be great if you could help with the above.
    Cheers

  40. #40
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    I'm out at the moment.
    I wll get back to you later.

  41. #41
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    Just looked at your file...

    You have partially colored rows in " LOGBOOK METHODPARTIAL" sheet.
    Can you show me the result you want when each one of the method selected?

    The layouts you sent is not feasible to me.

  42. #42
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    Hi jindon, sorry I didn't receive a notification email when you replied on the 17th.

    Please find attached what would be the result if selected "LOGBOOK METHODPARTIAL" (only red rows would appear).

    So the idea with the colors is, when something is selected, only that color would appear (although sometimes multiple colors would appear, which is fine as long as the selected color is still there).

    Cheers,
    Attached Files Attached Files

  43. #43
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    Can you do it manually for yourself? Hide all other range except red colored range?

    I don't think it is possible...

  44. #44
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    Other people will use the spreadsheet, this code is essential for my project :/

    Isn't it possible to code: if K15 equals to "LOGBOOK METHODPARTIAL", hide columns 1 to 28, and 33 to 37 from Car Mileage tab?

    And so on for all other options.

  45. #45
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    What I'm saying is that you can not partially hide columns/rows, means you can only hide whole column(s)/Row(s).

    You know what I mean?

  46. #46
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Help to fix macro: hidding multiple rows

    I think you need to rethink the project. How about setting up one tab for each of the various selections and have Excel show the correct tab depending on the option shown? Could that approach work for you?

  47. #47
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    Ah yes that's definitely fine, all good to hide the whole row.

    The colors in the first three columns in the sample spreadsheet are just for demonstration purpose only.

  48. #48
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    Then I need to see exact range(s) that you want to show when each one selected.

  49. #49
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    jindon I am working on the conditions now, but just wondering if instead of which rows want to show, can it be which rows want to be hidden?
    Show conditions are much more complicated than hide conditions.

  50. #50
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    If it is logically understandable and covers everything, OK.

    However your conditions seems multiple criteria now, so Change event is not the way to use.

    And I need to go out now, so my next response will be late.

  51. #51
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    I'm trying to simplify the conditions since your post one hour ago.
    Do you have any suggestions?

  52. #52
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Help to fix macro: hidding multiple rows

    Might I make a suggestion? Looking at post #29 again it would seem that you have a user form with multiple selection options. What it would be useful to know is how this is laid out (apologies if this is included here - I could not find it in its entirety in any of the workbooks I opened).

    What you need to do, it seems to me, is make a list of the various combinations possible at any one time, then list for each which rows on which sheets should be hidden. Don't bother with ranges - just rows and/or columns.

    I hope this helps.
    Last edited by AliGW; 04-19-2019 at 03:17 AM.

  53. #53
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    @jindon please find conditions spreadsheet attached. I tried to simplify as much as possible.
    Please note the rows in the spreadsheet are to be HIDE.

    The problem I had using the SHOW condition (instead of hide) is that I have 4 different areas in the Income tab, and I am using one reference for each area to decide if it is to be hidden or not. If I use the SHOW condition, I would need to use one reference resulting in 64 different scenarios. Using the HIDE condition, each area can be dealt separately: 4 scenarios in areas 1 and 2; 2 scenarios in areas 3 and 4.

    @AliGW, the problem of using one reference is that I would have 64 different scenarios: 4 options x 4 options x 2 options x 2 options = 64 scenarios

    edit: the rows in the CONDITION spreadsheet are not matching with the SAMPLE spreadsheet
    Attached Files Attached Files
    Last edited by ricdamiani; 04-19-2019 at 04:13 AM.

  54. #54
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    Just coded as per your instructions.

    1) Delete existing code in "Settings" sheet code module.

    2) To CAR MILEAGE sheet code module
    Please Login or Register  to view this content.
    3) To Income sheet code module
    Please Login or Register  to view this content.

  55. #55
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    jindon the code is almost perfect, almost there, but just a couple of problems in the second code:
    1) in the CONDITIONS spreadsheet I sent before, please see in rows 12 and 17 that there is a condition: if "NONE OF THE ABOVE", hide the respectively rows. I think this part missed in the code.
    2) cases 18 and 19 are not working properly. Case 18 works well when different than 3-YES, but still hides a few rows (225:238) when equal to 3-YES. Case 19 hide well rows when equals to 4-YES, but it doesn't UNHIDE when it is different than "4-YES".

    Sample file attached demonstrating the problems.

    Is there a way to fix these issues please?

    Very much appreciated! Cheers
    Attached Files Attached Files

  56. #56
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    Im not with my pc, so I will reply tomorrow.

  57. #57
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    ricdamiani

    Can you just include everything in one file, I mean conditions?
    And also all the drop downs should show the list, so that I may be albe to understand.

    I don't normally look back the file and the code as it is now using different method.

  58. #58
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    Hi jindon, please find amended spreadsheet attached as per instructions. Cheers
    Attached Files Attached Files

  59. #59
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    Try change to
    Please Login or Register  to view this content.

  60. #60
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    The macro is now working perfectly jindon, but what if the Income sheet is protected?

    I tired to insert .Unprotect "PASSWORD" below the "Application.ScreenUpdating = False" line, but it didn't work.

    Cheers,

  61. #61
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    You need to use "Me" key word.
    Please Login or Register  to view this content.

  62. #62
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    Awesome, thank you very much jindon

  63. #63
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    You are welcome and thanks for the rep.

  64. #64
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    jindon, I changed a bit your code for a new tab as per below. It is working properly, but the only problem is if e12 is not CENTS PER KILOMETRE METHOD, it should do nothing. How can I add this logic to the code?

    Logic: if e23 is not CENTS PER KILOMETRE METHOD, do nothing

    Please Login or Register  to view this content.
    Cheers

  65. #65
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    jindon, are you there?
    Cheers,

  66. #66
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    I'm in the middle of long holidays, so hard to response now.

    If only one condition
    Please Login or Register  to view this content.

  67. #67
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Help to fix macro: hidding multiple rows

    Of course, sorry I forgot about that.

    Thanks and happy Golden Week!

    Cheers

  68. #68
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Help to fix macro: hidding multiple rows

    No problem, easy to forget when you think it over and over.

+ 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. [SOLVED] macro showing error ( macro not found ) while trying to execute macro every 1 minute
    By prabhuduraraj09 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2018, 07:58 PM
  2. [SOLVED] Define variable in macro than calling that macro inside another macro
    By jakopak in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-21-2015, 10:58 AM
  3. Using a macro on workbook1 to create a button in wb2 and assigning macro "wb2!macro"
    By penfold1992 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-13-2014, 11:39 AM
  4. [SOLVED] Macro to show Which macro didnt work in a nested macro
    By akhileshgs in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-10-2013, 03:21 AM
  5. Perform macro "on open" specific file- store macro in Personal Macro Workbook?
    By thompssc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-17-2012, 12:38 PM
  6. lookup macro, solver macro, realtime macro
    By xelhelp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-02-2011, 06:14 PM
  7. Cannot find macro error when running a macro from a macro in a diffrent workbook.
    By Acrobatic82 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2010, 09:22 AM

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