PDA

View Full Version : [SOLVED:] Userform command button does not respond when calling userform from custom ribbon



sgoodrich
01-26-2022, 06:53 AM
Hi,

I created a custom ribbon using an xml editor. I have set one of the buttons to open a userform. The userform initializes but when I click the command buttons they do not respond. Can someone help me modify the code so the command buttons will execute the code.

Below is the code that calls the userform


Sub import_exportCensusOut_v5_0(control As IRibbonControl)

frmProjects.Show


End Sub

Here is a portion of the code for the userform command button


Private Sub cmdCensusOut50_Click()

Dim wb As Workbook
Dim ws As Worksheet
Dim wbCensusOut As Workbook
Dim wsCensusOut As Worksheet
Dim firstrow As Long
Dim lastrow As Long
Dim lastcolumn As Long
Dim newFileName As String
Dim sFolder As String


Me.Hide


Application.ScreenUpdating = False


Set wb = ActiveWorkbook
Set ws = wb.Sheets("REPO-MOS-Tracker")


ws.AutoFilterMode = False
ws.Outline.ShowLevels RowLevels:=8, ColumnLevels:=8
lastcolumn = ws.Cells(3, ws.Columns.Count).End(xlToLeft).Column
lastrow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row

End Sub

sgoodrich
01-26-2022, 08:15 AM
Figured out the issue was the sub name did not make the command button name. Updated and all is working fine.