• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Button Macro Only Works if Run in Visual Basic View

I'm running into a couple of issues with a macro. I'm VERY new to VBA. I've attached a sample of what I'm building. I'm still in the early stages.
First issue: I have to manually run the macro for a photo I selected to appear
1. Open file to see System Sales Order Manager > Project Status
2. Click on Add Picture
3. Select Photo
4. ISSUE: Photo does not change
5. Open Visual Basic > Modules > PicMacro and open macro > click run
6. The picture changes
What is missing in the code or my set up that prevents the macro from displaying the photo I selected?

Second issue: The photo is supposed to only show in J10. However, if you click on the tabs, i.e., TASKS, CUSTOMER, PROPOSAL, etc. the photo shows up on J25, J45, J65, etc.
Thank you in advance for your time and willingness to assist me!
 

Attachments

  • Excel Training_Sample_Chandoo.xlsm
    62.4 KB · Views: 5
You forgot to 'show' the picture after adding it. Add this line to your macro Add_Pic:
Code:
'...'
    End With
        'On Existing Records, Add/Update Pictures in Database
        Call Show_Pic                             '<- added
NoSelection:
    End With
End Sub
Didn't check for other issues, I'll leave it to you.
 
YOU ARE AWESOME!!!! Thank you so very, very much!

I'm going to continue to work on figuring out the second issue. Again, thank you!!!
 
Just a little help before going to sleep, it's late for me ;).
Add this to your macro SwitchHorizontalTabs:
Code:
'...'
With Sheet1
        SelCol = .Range("B2").Value
        '---added---
        If SelCol = 5 Then
            .Shapes("Pic").Visible = msoTrue
        Else
            .Shapes("Pic").Visible = msoFalse
        End If
        '-----------
        .Range("5:144").EntireRow.Hidden = True
        FirstRow = 5 + ((SelCol - 5) * 20)
        .Range(FirstRow & ":" & FirstRow + 19).EntireRow.Hidden = False
    End With
End Sub
 
It works perfectly! Did you take courses in VBA/Macros or did you learn on your own? I'm such an Excel geek, but have so much more to learn. Thank you very much!
 
This and that and banging my head o_O and it has taken me at least 40 years :DD.
Thanks for the positive feedback, glad having been of some help.
 
 
Back
Top