View Single Post
 
Old 07-22-2019, 08:15 PM
kiwimtnbkr kiwimtnbkr is offline Windows 10 Office 2010 64bit
Advanced Beginner
 
Join Date: Oct 2017
Posts: 69
kiwimtnbkr is on a distinguished road
Default Worksheet_Activate only if .xltm

The workbook template opens on worksheet1 which contains some instructions. When the user clicks on the worksheet2 tab to fill in the required information then the following original code caused a dropdown list to appear:

Code:
Private Sub Worksheet_Activate()
Range("H4").Select
Sendkeys "%{up}{NUMLOCK}", True
End Sub
When the workbook template saves it is saved as an .xlsm. I added the below code to stop the Sub from running when the now .xlsm file is opened

Code:
Private Sub Worksheet_Activate()
If ActiveWorkbook.FileFormat = xlOpenXMLWorkbookMarcoEnabled Then Exit Sub
Range("H4").Select
Sendkeys "%{up}{NUMLOCK}", True
End Sub
but this has now caused the dropdown list to no longer drop down in the .xltm file when the user clicks on the worksheet2 tab.

Where am I going wrong?

cheers
Mike

Last edited by kiwimtnbkr; 07-23-2019 at 01:41 PM. Reason: restructured question to reflect what is actual happening
Reply With Quote