+ Reply to Thread
Results 1 to 18 of 18

show hide shape to a cell problem with code

  1. #1
    Registered User
    Join Date
    02-10-2015
    Location
    cyprus
    MS-Off Ver
    2010
    Posts
    50

    show hide shape to a cell problem with code

    i have the following code, the first part which is show/hide rows works fine. the second part of the code is not working very well. is suppose to hide "LOAD" (1 until 60) whenever there is a number in cell D12:D71.
    it used to work really nice in another sheet but now just hides several of them i don't know why.
    can you please help me.

    p.s. TMS helped me in the past with this code

    code for excell file is 12341

    Please Login or Register  to view this content.
    this my excel file
    exe1.xlsm
    Last edited by pavlos_x; 03-18-2015 at 01:48 PM.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: show hide shape to a cell problem with code

    Hi,

    Try the following code which is also in the attached workbook.
    Please Login or Register  to view this content.
    Lewis

  3. #3
    Registered User
    Join Date
    02-10-2015
    Location
    cyprus
    MS-Off Ver
    2010
    Posts
    50

    Re: show hide shape to a cell problem with code

    their seems to have a problem, when i i reference the cell with other sheet it does auto update the show or hide shape

    ExcelForumDisplayHideShape-2015-03-22-14-50.xlsm

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: show hide shape to a cell problem with code

    The code requires a slightly different approach Sub Worksheet_Calculate() when a cell changes value from a formula. Try the following code which is included in the attached workbook.

    Please Login or Register  to view this content.
    Lewis

  5. #5
    Registered User
    Join Date
    02-10-2015
    Location
    cyprus
    MS-Off Ver
    2010
    Posts
    50

    Re: show hide shape to a cell problem with code

    OK THAT is amazing thank you so much. one more thing please, is there a way after shape is auto SHOWN, the rows bellow then ARE HIDDEN? you see where i choose to hide or show rows? i want to eliminate that and to do the show or hide rows automatic when shape is visible or not.

  6. #6
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: show hide shape to a cell problem with code

    Hi,

    Thanks for the kind words. Try the following macros which are included in the attached file. Please let me know if the file does not behave EXACTLY per your specifications.

    Please Login or Register  to view this content.
    Lewis

  7. #7
    Registered User
    Join Date
    02-10-2015
    Location
    cyprus
    MS-Off Ver
    2010
    Posts
    50

    Re: show hide shape to a cell problem with code

    first of all you are amazing, thank you. there are things i couldn't imagine they could happen in this project and when ever i do something plus to it it gives me new ideas on how to proceed.

    1) i want to completely remove L1 and (no value in that cell at all) i think it works yes?
    2) at the beginning you have Private Const sSheetNAME = "MAIN DB MULTILINE 1P"
    i also have another sheet which is called "MAIN DB MULTILINE 3P" it has the same formatting with a slide little diference,
    is there a way to add it at this code or do i have to copy paste the whole thing to the sheet code of "MAIN DB MULTILINE 3P"?


    Lewis if you know is it possible to do the program web based? i did a search but it costs a lot and second they only convert simple excel programs without macro and vba code. i am trying to develop this for my students. i teach adults electrical courses in vocational night school and they are very interested in this software. it will help them a lot. by the way the software has many sheets and many calculations.

    thank you very very much

  8. #8
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: show hide shape to a cell problem with code

    Thank you for the kind words and the rep points.

    i want to completely remove L1 and (no value in that cell at all) i think it works yes?
    I don't think you can do that completely. You probably at the very least need 'UNHIDE', or you won't be able to add a value to a hidden row.

    at the beginning you have Private Const sSheetNAME = "MAIN DB MULTILINE 1P"
    i also have another sheet which is called "MAIN DB MULTILINE 3P" it has the same formatting with a slide little diference, is there a way to add it at this code or do i have to copy paste the whole thing to the sheet code of "MAIN DB MULTILINE 3P"?
    You have to cut and paste the code to the new Sheet and change the name to '3P'.


    is it possible to do the program web based? i did a search but it costs a lot and second they only convert simple excel programs without macro and vba code. i am trying to develop this for my students. i teach adults electrical courses in vocational night school and they are very interested in this software. it will help them a lot. by the way the software has many sheets and many calculations.
    I don't know, since I don't use Web Based Excel. I did all the software using Excel 2003.

    If you can buy on Ebay UK, you can get Office 2003 for $25 US Dollars (30 Euros) each including postage. Postage may be a lot less than the $14 each if you buy several copies: http://www.ebay.co.uk/itm/Microsoft-...item51c9a69de9

    Lewis

  9. #9
    Registered User
    Join Date
    02-10-2015
    Location
    cyprus
    MS-Off Ver
    2010
    Posts
    50

    Re: show hide shape to a cell problem with code

    thank you very much

  10. #10
    Registered User
    Join Date
    02-10-2015
    Location
    cyprus
    MS-Off Ver
    2010
    Posts
    50

    Re: show hide shape to a cell problem with code

    now my file is running slower than before why is that? it has to do with calculations of macro?

  11. #11
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: show hide shape to a cell problem with code

    Try adding the lines in red (very busy today, so I didn't have time to test the code):
    Please Login or Register  to view this content.
    Lewis

  12. #12
    Registered User
    Join Date
    02-10-2015
    Location
    cyprus
    MS-Off Ver
    2010
    Posts
    50

    Re: show hide shape to a cell problem with code

    now its ok but there is to much screen flickering on another sheet. it affected my other sheet which it has this

    Please Login or Register  to view this content.

  13. #13
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: show hide shape to a cell problem with code

    I think it's time for you to upload a sample workbook. If the workbook is too big, put it in a zip file.

    Lewis

  14. #14
    Registered User
    Join Date
    02-10-2015
    Location
    cyprus
    MS-Off Ver
    2010
    Posts
    50

    Re: show hide shape to a cell problem with code

    thanks Lewis

    i forgot to unlock it again, pass is 12341

    on MDB sheet when i hide and show cells (from H1) screen flickers
    and when insert number 30 in cell H3:H62 the shape appears but is slow
    and when changing number in E3:E62 is slow

    new.xlsm
    Last edited by pavlos_x; 03-25-2015 at 01:06 PM.

  15. #15
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: show hide shape to a cell problem with code

    I was unable to duplicate your problem on a Windows 8.1 computer using 32 bit Excel 2010. You can add the 2 items in red above (Application.EnableEvents), but when I added them, it did not make a difference. When I made a change on sheet 'Main DB' (1 cell or several cells), I had a delay of about one-half second, but I did not see any screen flicker.

    Lewis

  16. #16
    Registered User
    Join Date
    02-10-2015
    Location
    cyprus
    MS-Off Ver
    2010
    Posts
    50

    Re: show hide shape to a cell problem with code

    that delay cannot be fixed?

  17. #17
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: show hide shape to a cell problem with code

    The problem is that accessing shapes takes a (relatively) long time, even if no changes are required to the shape. I tried to improve the time performance, but was not successful. Sorry, but I did the best I could.

    It is possible that someone with more skill than I could make the macros run faster.

    Lewis

  18. #18
    Registered User
    Join Date
    02-10-2015
    Location
    cyprus
    MS-Off Ver
    2010
    Posts
    50

    Re: show hide shape to a cell problem with code

    its ok you already did too much thank you

+ 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] show hide shape to a cell according to its value
    By pavlos_x in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-14-2015, 05:34 PM
  2. Show/Hide Group of shapes while keeping individual shape visibility settings
    By Voldenite in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-14-2015, 03:12 AM
  3. Hide/show shape on Sheet1 based on cell value in Sheet2?
    By Guple in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-05-2013, 02:12 PM
  4. Show/Hide Shape VBA
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-06-2013, 09:03 AM
  5. [SOLVED] Show & Hide Shape in a Sheet
    By Pete Csiszar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-14-2005, 10:07 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