+ Reply to Thread
Results 1 to 5 of 5

Shortcut - macro

  1. #1
    Registered User
    Join Date
    02-18-2008
    Posts
    5

    Shortcut - macro

    Hi, I'd like to add a keybord shortcut for the 'Format Painter' tool. I've tried to make a macro with the shortcut ctrl+shift+v

    Please Login or Register  to view this content.
    It works if I've copied a cell before I press ctrl+shift+v, but if no cell is copied I get a run-time error '1004' - 'Paste special method of range class failed.'

    Any thoughts?

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    The format painter copies the format from one cell and applies it to a destination cell. If no cell is copied, then it cannot apply a format, hence the error.

    If not copying a cell's format, what exactly are you trying to do? Perhaps we can find a workaround.

  3. #3
    Registered User
    Join Date
    02-18-2008
    Posts
    5
    Thanks for the reply.

    If I accidentaly press 'ctrl+shift+v' without having previously copied a cell I don't want anything to happen, but if I have copied a cell, I'd like to be able to copy the format to several cells (equivalent to the dobbleclick on the format painter)

    Sorry that I didn't explain it thoroughly.

  4. #4
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    I see. I misunderstood you the first time. Try this code. It will exit the sub if there is an error, but should paste the format if a cell is selected:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-18-2008
    Posts
    5
    Thanks Problem solved

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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