+ Reply to Thread
Results 1 to 7 of 7

VBA that exits a MACRO if clipboard is empty

  1. #1
    Registered User
    Join Date
    12-26-2016
    Location
    London, England
    MS-Off Ver
    365
    Posts
    79

    VBA that exits a MACRO if clipboard is empty

    Hi I have some code that relies on there being data in the CLIPBOARD prior to it being pasted, and I need some code instered into the VBA below that exits out of the macro when the Clipboard is empty or on an error or such like - Is that possible?

    Please Login or Register  to view this content.
    Of course I get a debug error on the PASTESPECIAL line if there is no data in the clipboard.

    Can anyone help?

    Regards
    Hans

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: VBA that exits a MACRO if clipboard is empty

    Hello,
    Would it be better to copy the cell in your code, then you wouldn't have to worry about it?

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA that exits a MACRO if clipboard is empty

    Does this help?

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-26-2016
    Location
    London, England
    MS-Off Ver
    365
    Posts
    79

    Re: VBA that exits a MACRO if clipboard is empty

    I'm not copying cells

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: VBA that exits a MACRO if clipboard is empty

    Your not copying cells?
    But you are pasting cells...

  6. #6
    Registered User
    Join Date
    12-26-2016
    Location
    London, England
    MS-Off Ver
    365
    Posts
    79

    Re: VBA that exits a MACRO if clipboard is empty

    I'm copying data from an intranet webpage into the sheet

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: VBA that exits a MACRO if clipboard is empty

    Ah I see.

    Probably:
    Please Login or Register  to view this content.
    should work, place it before the paste code

+ 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] Macro to check if sheet name exits
    By robrobet in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-06-2015, 01:00 PM
  2. [SOLVED] Macro that pastes from the clipboard into the next empty cell in a column
    By Msimm14 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-31-2013, 02:14 AM
  3. Excel 2007 : Cannot empty clipboard
    By friebe13 in forum Excel General
    Replies: 1
    Last Post: 11-22-2011, 09:24 PM
  4. Reprotect after macro exits.
    By D1TrueGod in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-20-2008, 12:34 AM
  5. [SOLVED] Cannot empty the clipboard
    By cjones in forum Excel General
    Replies: 0
    Last Post: 08-09-2006, 06:14 PM
  6. cannot empty the clipboard
    By tomcat3 in forum Excel General
    Replies: 13
    Last Post: 07-07-2006, 04:15 PM
  7. How do I empty the clipboard, when nothing is in it?
    By Jill in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-05-2005, 07: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