Results 1 to 1 of 1

Keep pasted picture reference constant for use by different macros

Threaded View

  1. #1
    Registered User
    Join Date
    10-23-2012
    Location
    RSA
    MS-Off Ver
    Excel 2013
    Posts
    6

    Keep pasted picture reference constant for use by different macros

    Hi everyone,

    I have written a macro (Macro 1) that, upon certain conditions being fulfilled, it copies two separate pictures from a worksheet and pastes it on a different worksheet. I then proceeded to write a different macro (Macro 2) upon which I want those two particular pictures to be deleted from the worksheet they were pasted on in order to enable the user to choose different options, which will lead to different pictures being copied and pasted.

    My problem is that everytime Macro 1 is executed, the picture references change on the worksheet to which they are copied. Therefore Macro 2 can't select them for deletion.

    How can I change the code in order to delete the pictures from the worksheet again?

    Code for Macro 1:
    If Range("O5").Value = "Worksheet one" Then
          Sheets("Worksheet two").Select
          ActiveWindow.SmallScroll Down:=6
          ActiveSheet.ChartObjects("Chart 1").Activate
          ActiveSheet.ChartObjects("Chart 1").Activate
          ActiveChart.ChartArea.Copy
          Sheets("Worksheet three").Select
          Range("E52").Select
          ActiveSheet.PasteSpecial Format:="Picture (PNG)", Link:=False, _
              DisplayAsIcon:=False
          Sheets("Worksheet two").Select
          ActiveSheet.Shapes.Range(Array("TextBox 2")).Select
          Selection.Copy
          Sheets("Worksheet three").Select
          Range("G73").Select
          ActiveSheet.PasteSpecial Format:="Picture (PNG)", Link:=False, _
              DisplayAsIcon:=False
          Range("N74").Select
    Code for Macro 2:
    ActiveWindow.SmallScroll Down:=60
        ActiveSheet.Shapes.Range(Array("Picture 9")).Select
        Selection.Delete
        ActiveSheet.Shapes.Range(Array("Picture 8")).Select
        Selection.Delete
        ActiveWindow.SmallScroll Down:=-87
        Sheets("Worksheet four").Select
    Thank you in advance,
    Corneli
    Last edited by Corneli; 06-09-2014 at 09:49 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 02-10-2014, 12:29 PM
  2. Can Macros be set to automatically run when something is pasted or typed into a cell?
    By Lylestyle89 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-25-2013, 09:06 PM
  3. Auto Resize Pasted Picture to merged cell
    By CyberPath in forum Excel General
    Replies: 2
    Last Post: 04-15-2012, 07:13 AM
  4. changing property of a picture that is already pasted on excel
    By cc in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 06-10-2009, 09:33 PM
  5. Replies: 2
    Last Post: 01-28-2005, 01:06 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