ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Slight Annoyance (https://www.excelbanter.com/excel-programming/447531-slight-annoyance.html)

cosmmarchy

Slight Annoyance
 
1 Attachment(s)
Hello all,

I have a spreadsheet which creates a button when cells in column B are clicked. The annoyance is that when you click cells in column B, there is a delay where the clicked cell is highlighted, the button is deleted and then reappears next to the new cell.

Is there a way to improve this so that the button is deleted when the old cell looses focus and reappears with the new cell?

If you click any cell in column C you'll see the difference between what I have and how the button appears with the data validation.

It would be nice to have the same button visibility.

Is there a way?

Thanks

isabelle

Slight Annoyance
 
hi,

i did a test with visible = true or false and i do not see any difference,
it may be a matter performance of the video card

Code:

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
target As Range)

    Dim ctrl As Button, isect

    On Error Resume Next

    Application.ScreenUpdating = False
'    Application.EnableEvents = False

    Set isect = Application.Intersect(target, Range("B:B"))
    Set ctrl = Sh.Buttons("test")


    If Not isect Is Nothing Then
          If Not ctrl Is Nothing Then
            ctrl.Visible = False
            ctrl.Top = target.Top
            ctrl.Visible = True
          Else
            Set ctrl = Sh.Buttons.Add(target.Left + target.Width + 2,
target.Top, 15, target.Height)
            ctrl.Top = target.Top
            ctrl.OnAction = "ThisWorkbook.Clicked"
            ctrl.Font.Bold = True
            ctrl.Text = "..."
            ctrl.Name = "test"
            Set ctrl = Nothing
          End If
        Else
      ctrl.Visible = False
    End If

    Application.ScreenUpdating = True
'    Application.EnableEvents = True

End Sub


--
isabelle


Le 2012-10-31 10:13, cosmmarchy a écrit :
Hello all,

I have a spreadsheet which creates a button when cells in column B are
clicked. The annoyance is that when you click cells in column B, there
is a delay where the clicked cell is highlighted, the button is deleted
and then reappears next to the new cell.

Is there a way to improve this so that the button is deleted when the
old cell looses focus and reappears with the new cell?

If you click any cell in column C you'll see the difference between what
I have and how the button appears with the data validation.

It would be nice to have the same button visibility.

Is there a way?

Thanks


+-------------------------------------------------------------------+
|Filename: Example.zip |
|Download: http://www.excelbanter.com/attachment.php?attachmentid=649|
+-------------------------------------------------------------------+






All times are GMT +1. The time now is 02:53 AM.

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