+ Reply to Thread
Results 1 to 18 of 18

IF D3 = Monday, Hide "Picture1"

  1. #1
    Registered User
    Join Date
    12-10-2013
    Location
    Cambs
    MS-Off Ver
    Excel 2010
    Posts
    40

    IF D3 = Monday, Hide "Picture1"

    Please help.

    I am attempting to hide a picture (Picture1) if cell D3 = "Monday".

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: IF D3 = Monday, Hide "Picture1"

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    12-10-2013
    Location
    Cambs
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: IF D3 = Monday, Hide "Picture1"

    I can't seem to get that to work. The picture is named "TELE" in the name box so I amended the code to:

    With ActiveSheet
    If .Range("D3").Value = "Monday" Then
    .Shapes("TELE").Visible = False
    Else
    .Shapes("TELE").Visible = True
    End If
    End With

  4. #4
    Registered User
    Join Date
    12-10-2013
    Location
    Cambs
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: IF D3 = Monday, Hide "Picture1"

    Thanks so much for helping by the way. Hugely appreciated.

  5. #5
    Registered User
    Join Date
    12-10-2013
    Location
    Cambs
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: IF D3 = Monday, Hide "Picture1"

    I can't seem to get that to work. The picture is named "TELE" in the name box so I amended the code to:

    With ActiveSheet
    If .Range("D3").Value = "Monday" Then
    .Shapes("TELE").Visible = False
    Else
    .Shapes("TELE").Visible = True
    End If
    End With

    Thanks so much for helping by the way. Hugely appreciated.

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: IF D3 = Monday, Hide "Picture1"

    Quote Originally Posted by a13ks View Post
    I can't seem to get that to work. The picture is named "TELE" in the name box so I amended the code to:

    With ActiveSheet
    If .Range("D3").Value = "Monday" Then
    .Shapes("TELE").Visible = False
    Else
    .Shapes("TELE").Visible = True
    End If
    End With
    The code worked in my test.

    What does not work exactly mean; error, nothing happens?

    Can you attach an example file?

  7. #7
    Registered User
    Join Date
    12-10-2013
    Location
    Cambs
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: IF D3 = Monday, Hide "Picture1"

    A crude version of the document attached.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    12-10-2013
    Location
    Cambs
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: IF D3 = Monday, Hide "Picture1"

    A crude version of the document is attached.
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: IF D3 = Monday, Hide "Picture1"

    Works for me. You will have to explain what is happening.
    Did you put the code in a sub in a module?
    If you want something done right... find a forum and ask an online expert.

    Time flies like an arrow. Fruit flies like a banana.

  10. #10
    Registered User
    Join Date
    12-10-2013
    Location
    Cambs
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: IF D3 = Monday, Hide "Picture1"

    Simply copy and pasted the code via the view code function on the appropriate tab.

    I'm a beginner at all this.

  11. #11
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: IF D3 = Monday, Hide "Picture1"

    The code worked for me using your example workbook.

    • Alt+F11 to open the VBA editor
    • Select Insert\Module from the VBA menu.
    • Paste the code from below in the edit window.
    • Run Macro1

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 06-26-2017 at 10:46 PM.

  12. #12
    Registered User
    Join Date
    12-10-2013
    Location
    Cambs
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: IF D3 = Monday, Hide "Picture1"

    Snip attached fyi
    Attached Images Attached Images

  13. #13
    Registered User
    Join Date
    12-10-2013
    Location
    Cambs
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: IF D3 = Monday, Hide "Picture1"

    AMAZING!!!

    Thank you so much. Apologies for the frustrating noviceness!

  14. #14
    Registered User
    Join Date
    12-10-2013
    Location
    Cambs
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: IF D3 = Monday, Hide "Picture1"

    All, Sorry me again.

    Would it be possible to extend this code for multiple days and multiple images?

    eg:
    If .Range("D3").Value = "Monday" Then
    .Shapes("PIC1").Visible = False
    .Shapes("PIC2").Visible = False
    .Shapes("PIC3").Visible = False
    .Shapes("PIC4").Visible = False
    .Shapes("PIC5").Visible = False
    If .Range("D3").Value = "Tuesday" Then
    .Shapes("PIC1").Visible = False
    .Shapes("PIC2").Visible = False
    .Shapes("PIC3").Visible = True
    .Shapes("PIC4").Visible = True
    .Shapes("PIC5").Visible = False
    If .Range("D3").Value = "Wednesday" Then
    .Shapes("PIC1").Visible = False
    .Shapes("PIC2").Visible = False
    .Shapes("PIC3").Visible = False
    .Shapes("PIC4").Visible = False
    .Shapes("PIC5").Visible = False
    If .Range("D3").Value = "Thursday" Then
    .Shapes("PIC1").Visible = True
    .Shapes("PIC2").Visible = False
    .Shapes("PIC3").Visible = False
    .Shapes("PIC4").Visible = False
    .Shapes("PIC5").Visible = True
    If .Range("D3").Value = "Friday" Then
    .Shapes("PIC1").Visible = True
    .Shapes("PIC2").Visible = True
    .Shapes("PIC3").Visible = False
    .Shapes("PIC4").Visible = False
    .Shapes("PIC5").Visible = False
    If .Range("D3").Value = "Saturday" Then
    .Shapes("PIC1").Visible = True
    .Shapes("PIC2").Visible = True
    .Shapes("PIC3").Visible = False
    .Shapes("PIC4").Visible = False
    .Shapes("PIC5").Visible = False

  15. #15
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: IF D3 = Monday, Hide "Picture1"

    Probably this

    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    12-10-2013
    Location
    Cambs
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: IF D3 = Monday, Hide "Picture1"

    Thank you.

    I can stop banging my head against the wall now.

  17. #17
    Registered User
    Join Date
    12-10-2013
    Location
    Cambs
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: IF D3 = Monday, Hide "Picture1"

    Thank you so much for this.

    I have been trying to work with this to work with the date input in D3 rather than having to run a separate macro.

    Is that possible?

  18. #18
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: IF D3 = Monday, Hide "Picture1"

    Quote Originally Posted by a13ks View Post
    Thank you so much for this.

    I have been trying to work with this to work with the date input in D3 rather than having to run a separate macro.

    Is that possible?
    Please Login or Register  to view this content.

+ 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] Why does the "CountIF" function fails on value "Monday Week 1"?
    By kashbg in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-02-2015, 03:24 PM
  2. Replies: 1
    Last Post: 09-21-2013, 03:18 AM
  3. Excel 2002 "Protect Sheet", but allow "Hide Columns"?
    By Dave Peterson in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 12:05 PM
  4. [SOLVED] Excel 2002 "Protect Sheet", but allow "Hide Columns"?
    By VP Safe in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  5. [SOLVED] Excel 2002 "Protect Sheet", but allow "Hide Columns"?
    By Dave Peterson in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 04:05 AM
  6. Excel 2002 "Protect Sheet", but allow "Hide Columns"?
    By VP Safe in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  7. Excel 2002 "Protect Sheet", but allow "Hide Columns"?
    By VP Safe in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10: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