Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default Keep contents in clipboard

unlike several other posts about clipboard, which want to clear the
clipboard, or close the clipboard window, etc., my objective is the opposite.

Problem:
The way I describe it (which might not be technically accurate) Excel clears
clipboard when a "intervening event" occurs after a paste and before the
request for a paste.
Perhaps because I have some VBA code (Worksheet Event Calculate, see below),
I can't do consecutive pastes from an original copy. One paste is all I get
out of the clipboard.

Can I add anything in VBA to retain the last copied instance (may be many
contiguous cells) in the clipboard? or get the most recent copied instance
from the Office Clipboard back into the excel clipboard?

Any other thoughts?

Here is the only VBA code running in my spreadsheet:

Private Sub Worksheet_Calculate()
'This code colors the cells in PROVIDER STATUS Column U (col 21 below)
'depending on the text in each cell (not case sensitive)
'If the column containing Provider Status moves because of inserted
'columns, then change "21" below to correspond to the new column
Dim cell As Range
Dim eRow As Long
eRow = Cells(Rows.Count, 21).End(xlUp).Row
Application.ScreenUpdating = False 'turn off triggering events during
this routine
Application.EnableEvents = False 'turn off screen refreshing during
this routine
For Each cell In Range(Cells(1, 21), Cells(eRow, 21))
Select Case UCase(cell.Value) 'set the test value to upper case
Case "RED"
cell.Interior.Color = vbRed
cell.Font.Color = vbWhite
cell.Font.Bold = True
Case "YELLOW"
cell.Interior.Color = vbYellow
cell.Font.Bold = True
Case "GREEN"
cell.Interior.Color = RGB(46, 139, 87)
cell.Font.Color = vbWhite
cell.Font.Bold = True
Case "BLUE"
cell.Interior.Color = RGB(30, 144, 255)
cell.Font.Color = vbWhite
cell.Font.Bold = True
Case "BLACK"
cell.Interior.Color = vbBlack
cell.Font.Color = vbWhite
cell.Font.Bold = True
Case "GREY"
cell.Interior.Color = RGB(127, 127, 127)
cell.Font.Color = vbWhite
cell.Font.Bold = True
Case "PURPLE"
cell.Interior.Color = RGB(139, 0, 139)
cell.Font.Color = vbWhite
cell.Font.Bold = True
'If additional status text is used or addtl colors needed, insert
before the next CASE ELSE stmt
Case Else
cell.Font.ColorIndex = xlColorIndexAutomatic
cell.Interior.ColorIndex = xlColorIndexNone
End Select
Next
Application.EnableEvents = True 'turn on event triggering
Application.ScreenUpdating = True 'turn on screen refreshing
End Sub


Thanks in advance.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I keep clipboard contents active in excel? Gunchla Excel Discussion (Misc queries) 1 January 30th 06 02:49 PM
Clear clipboard contents Cordobes Excel Discussion (Misc queries) 4 November 22nd 05 02:41 AM
VBA: Answer YES to Contents of Clipboard ajocius Excel Programming 3 July 23rd 05 03:50 PM
Set variable to clipboard contents? Fred Smith Excel Programming 2 September 5th 04 08:23 PM
Clipboard contents Basil[_2_] Excel Programming 0 October 8th 03 06:05 PM


All times are GMT +1. The time now is 04:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"