+ Reply to Thread
Results 1 to 2 of 2

Excel empties the clipboard when adding borders! Is there a work-a-round?

  1. #1
    Forum Contributor
    Join Date
    10-13-2012
    Location
    Southern California
    MS-Off Ver
    Excel 2007
    Posts
    403

    Excel empties the clipboard when adding borders! Is there a work-a-round?

    Greetings,

    It took me over an hour this morning, but I finally figured out a problem I was having. But now I'm in need of a work-a-round.

    I created a VBA spreadsheet that otherwise works fine. But my users quickly found out they couldn't copy data from one worksheet and paste the data into another worksheet. After they copied it, and then after they selected a different worksheet, PASTE and PASTE SPECIAL were greyed out and not available.

    They WERE able to paste the data if they temporarily toggled the DESIGN MODE button and turned it on. But I didn't really want them to do that. They WERE able to paste data if they stayed on that same worksheet. But that wasn't what they wanted to do.

    Well, here's what was happening: When they selected another worksheet, the Worksheet Activate code for that sheet was naturally first executed. And part of that code clears out border lines from a table:
    Please Login or Register  to view this content.
    After doing some research and testing, it's this very code that caused the problem! If I bypass it, my users can paste fine. But if this code is executed, they can't.

    It seems that when this code is executed, Excel clears the clipboard. That's why PASTE and PASTE SPECIAL were greyed out... because there was no longer anything in the clipboard to paste!

    Ideally, I want my users to be able to copy and paste data from one worksheet to another, but also, ideally, I'd like to be able to execute the above code in the Worksheet Activate subroutine... it's part of my code and what I want to do.

    Any ideas?

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,659

    Re: Excel empties the clipboard when adding borders! Is there a work-a-round?

    Perhaps use a different worksheet event other than Worksheet_Activate; maybe Worksheet_Change or Worksheet_Deactivate? I don't understand your requirement to repeatedly clear the borders.

    Also, this one line will clear all the borders. It's not a solution though.
    Selection.Borders.LineStyle = xlNone
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

+ 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. Check a range of cells for empties
    By coachdave in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-11-2008, 05:34 PM
  2. [SOLVED] Adding Borders
    By Gord Dibben in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-06-2005, 07:05 AM
  3. [SOLVED] Adding Borders
    By Wayne in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  4. [SOLVED] Adding Borders
    By Wayne in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  5. Adding Borders
    By Wayne in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10: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