Wednesday, November 9, 2016

Excel Sheet Adding - Deleting With Userform

Excel Vba Add Sheet - Assigning Macro To Short-Cut Key

           If "F9 key" is pressed on the any sheet, the form opens.Any sheet or sheets in workbok can be deleted and can be added new sheet to workbook with this userform.

With combobox can be navigated between sheets of the workbook. If selected any sheet from combobox ,that sheet's tab is activated .

The created codes is following to assign macro F9 key :
"Sub Auto_Open()
Application.OnKey "{F9}", "Show"
End Sub
 Sub Show()
    UserForm1.Show
End Sub"

The created codes is following to list worksheets name on listbox and combobox :
"...
Dim sayfa As Integer
    For sayfa = 1 To Sheets.Count
        ListBox1.AddItem Sheets(sayfa).Name
        ComboBox1.AddItem Sheets(sayfa).Name
    Next sayfa
....
"

excel vba add sheet