Results 1 to 10 of 10

Code for inserting group (image) on open

Threaded View

  1. #1
    Forum Contributor
    Join Date
    01-04-2013
    Location
    Arkansas
    MS-Off Ver
    Microsoft Excel 2016
    Posts
    252

    Code for inserting group (image) on open

    I have 5 different groups (Group 002, 003, 004, 005 and 007) that need to be inserted on different days. 005 on Mondays, 004 on Tuesdays, 003 on Wednesdays, 002 on Thursdays and 007 Fridays Saturdays and Sundays. I started the below code, but as you can see, I don't quite have it correct.


    Private Sub Workbook_Open()
    Sheet1.Unprotect Password:="cards"
    
        Sheets("Routine").Select
        Application.ScreenUpdating = False
        
        On Error Resume Next
        ActiveSheet.Shapes("Group 002").Delete ' if they exist
        ActiveSheet.Shapes("Group 003").Delete
        ActiveSheet.Shapes("Group 004").Delete
        ActiveSheet.Shapes("Group 005").Delete
        ActiveSheet.Shapes("Group 007").Delete
        On Error GoTo 0
    
        If Weekday(Range("L1").Value) > 5 Or Weekday(Range("L1").Value) = 1 Then ' Friday - Sunday
            Sheets("Tours").Shapes("Group 007").Copy
        Else  ' Monday
            Sheets("Tours").Shapes("Group 005").Copy
        End If
    
        ActiveSheet.Paste
        Selection.Left = 0
        Selection.Top = 1038
        Sheet1.Protect Password:="cards"
        
    End Sub
    Attached Files Attached Files
    Last edited by jmcole; 11-05-2014 at 08:01 PM. Reason: Attached workbook

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Inserting image into userform controls strictly through code
    By DJams in forum Excel Programming / VBA / Macros
    Replies: 42
    Last Post: 11-24-2023, 03:55 AM
  2. Code for inserting objects and appearing as an image from the same worksheet
    By ryanhk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-01-2013, 11:26 PM
  3. [SOLVED] Request Hyperlink macro code to open new image per line
    By ganeshinscribe in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-25-2012, 02:27 AM
  4. [SOLVED] Inserting Open Event code via VBA
    By Pete in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-28-2006, 02:40 PM
  5. [SOLVED] Inserting a worksheet into an open workbook via VBA code
    By manillla in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-13-2005, 09: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