Forum Discussion

tgrondin's avatar
tgrondin
Copper Contributor
Jun 20, 2022
Solved

Excel vba buttons disappearing

Hi, I'm an other one who has a problem with disappearing buttons. I'm using a macro enabled excel file as a template for another software (Altium). When I generate the new file my two buttons disappe...
  • Michelle Trudeau's avatar
    Jan 04, 2023

    tgrondin 

    Once I noticed that toggling between views made my buttons appear, I solved this problem by adding a page view instruction to a worksheet change code I was already running.  If you aren't running a worksheet change code, you can still add one to target any cell(s) that user must change (in my case, user must input a number to proceed).  If that's not an option, you can create a workbook open event that changes a cell (i.e. inserts date) 10 seconds after the workbook opens.  

     

    Private Sub Worksheet_Change(ByVal Target As Range)

    On Error Resume Next

    Application.EnableEvents = False

    Dim rng As Range
    Set rng = Range("A9:A10009")

    If Not Intersect(Target, rng) Is Nothing Then
    Target.Value = UCase(Target.Value)
    ActiveWorkbook.Save
    ActiveWindow.View = xlPageLayoutView
    End If

    Application.EnableEvents = True

    End Sub

Resources