muhleebbin
Active Member
- Joined
- Sep 30, 2017
- Messages
- 252
- Office Version
- 365
- 2019
- 2016
- 2013
- 2010
- Platform
- Windows
- MacOS
- Mobile
- Web
I have a userform that is supposed to load when a pivottableupdate occurs (change in year is selected in a slicer), however when I open the workbook, it pops up the userform. I have unchecked the box for 'Refresh data when opening the file' however suspect it's due to this code that dynamically adds the year to the slicer as the years pass:
Call hideMyForm contains the following in hopes to unload the form however it is not working as expected. Is there a way to disable this form on workbook open?
Thanks
VBA Code:
Private Sub Workbook_Open()
Dim lr As String
lr = Sheets("Lists").Range("C1").Value
Application.ScreenUpdating = False
With Sheets("Year").ListObjects("Table2")
If Not .DataBodyRange Is Nothing Then
.DataBodyRange.Delete
End If
End With
Sheets("Year").Range("A2").Formula = "=IF(Lists!$B$1-2013>=ROW(),ROW()+2013,"""")"
Sheets("Year").Range("A2:A" & lr).FillDown
ActiveWorkbook.RefreshAll
Application.ScreenUpdating = True
Call hideMyForm
End Sub
Call hideMyForm contains the following in hopes to unload the form however it is not working as expected. Is there a way to disable this form on workbook open?
Thanks
VBA Code:
Sub hideMyForm()
Unload OAR
End Sub