Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    May 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Copy Paste Disabled (2000)

    Hello -

    I need to force a recalculation to occur so a user function that I am using to copy comments into cells works automaticaly without resorting to using F9. ( http://www.pcmag.com/article2/0,2704,2130132,00.asp ) The following VB code accomplishes the automatic recalculation however if I try a copy then paste (both using the right-click or edit menu) the Paste is greyed-out.

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not ActiveWorkbook.Saved Then
    ActiveSheet.Calculate
    End If

    End Sub

    What can I do to remedy this??

    Thanks,
    Howard

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Copy Paste Disabled (2000)

    The event procedure recalculates the sheet when you move to another cell. But this clears Excel's clipboard - you'll see the blinking border around the copied cells disappear.
    I'd live without the event procedure if I were you.

  3. #3
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Copy Paste Disabled (2000)

    In addition to Hans' comment on the event procedure clearing the clipboard, it also clears the UNDO stack which essentially disables the UNDO feature.

    This is another reason to eliminate the code triggered by the event...

    Steve

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy Paste Disabled (2000)

    Ugly, but you might get by by replacing
    Activesheet.calculate

    with

    SendKeys "{F9}"
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  5. #5
    New Lounger
    Join Date
    May 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy Paste Disabled (2000)

    Jan - The SendKeys "(F9)" works but there is a several second lag until it performs the recalculation which did not happen when I used the ActiveSheet.Calculate.

    Any idea why?

    Thanks very much,
    Howard

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy Paste Disabled (2000)

    No, not really. Probably because Excel is doing something before it returns control to the user, which is when the F9 key takes effect?
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •