ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Really Need Help: side effect clears clipboard!!! (https://www.excelbanter.com/excel-programming/292868-really-need-help-side-effect-clears-clipboard.html)

Bura Tino

Really Need Help: side effect clears clipboard!!!
 
Hi,

I have a procedure (shown below) which makes a Controls Toolbar button
vizible if "A1" is selected. An unfortunate side effect is that having this
procedure kills the ability to copy and paste -- if something had been
selected and copied, it disappears once any other cell is clicked.

Can anyone suggest a work around?

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Address = "$A$1" Then
AddFundButton.Visible = True
Else
AddFundButton.Visible = False
End If
End Sub


Many thanks in advance,

Bura

teatree[_7_]

Really Need Help: side effect clears clipboard!!!
 
odd. it works for me.
i had to change the AddFundButton t
ActiveSheet.Shapes("AddFundButton") but that is the only thing
modified. i was able to copy from the page with the button to anothe
sheet, and from a sheet to the button page, and activate/deactivate th
button in-between. I'm using excel 97 on win 98.

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Address = "$A$1" Then
ActiveSheet.Shapes("AddFundButton").Visible = True
Else
ActiveSheet.Shapes("AddFundButton").Visible = False
End If
End Sub

it might have something to do with the "Selection change" since you'l
be doing that when you pick a target range for your copied cells. tr
tying the event to something else, like doubleclick... in that case
you might want to eliminate your Else statement, and have the butto
toggle on/off when A1 is doubleclicked, see if this will work fo
you...

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range
Cancel As Boolean)
If Target.Address = "$A$1" Then
With ActiveSheet.Shapes("AddFundButton")
.Visible = Not .Visible
End With
End If
End Su

--
Message posted from http://www.ExcelForum.com


Frank Kabel

Really Need Help: side effect clears clipboard!!!
 
Hi
not tested but give it a try

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
static status
If Target.Address = "$A$1" Then
AddFundButton.Visible = True
status = True
Elseif status
AddFundButton.Visible = False
status = False
End If
End Sub



--
Regards
Frank Kabel
Frankfurt, Germany

Bura Tino wrote:
Hi,

I have a procedure (shown below) which makes a Controls Toolbar

button
vizible if "A1" is selected. An unfortunate side effect is that
having this procedure kills the ability to copy and paste -- if
something had been selected and copied, it disappears once any other
cell is clicked.

Can anyone suggest a work around?

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Address = "$A$1" Then
AddFundButton.Visible = True
Else
AddFundButton.Visible = False
End If
End Sub


Many thanks in advance,

Bura



Bura Tino

Really Need Help: side effect clears clipboard!!!
 
Hi
not tested but give it a try

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
static status
If Target.Address = "$A$1" Then
AddFundButton.Visible = True
status = True
Elseif status
AddFundButton.Visible = False
status = False
End If
End Sub


This does help, but I still can't paste TO or FROM A1.

(What's MS's design thinking behind this feature of clipboard clearing
upon certain actions?)


--
Regards
Frank Kabel
Frankfurt, Germany

Bura Tino wrote:
Hi,

I have a procedure (shown below) which makes a Controls Toolbar

button
vizible if "A1" is selected. An unfortunate side effect is that
having this procedure kills the ability to copy and paste -- if
something had been selected and copied, it disappears once any other
cell is clicked.

Can anyone suggest a work around?

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Address = "$A$1" Then
AddFundButton.Visible = True
Else
AddFundButton.Visible = False
End If
End Sub


Many thanks in advance,

Bura



All times are GMT +1. The time now is 12:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com