MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
I did find this snippet and too my surprise a command button was created.
Private Sub cmdJan14_Click() Worksheets("Jan14").Activate Worksheets("Jan14").Range("A1").Select End Sub
However, the subroutine needs to be added so I have that problem. Also, based upon the code above I need to modify specific properties. The properties of a command button would look like these:
Sub CreateButton() Dim Obj As Object Dim Code As String Sheets("Sheet1").Select 'create button Set Obj = ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", _ Link:=False, DisplayAsIcon:=False, Left:=200, Top:=100, Width:=100, Height:=35) Obj.Name = "TestButton" 'buttonn text ActiveSheet.OLEObjects(1).Object.Caption = "Test Button" 'macro text Code = "Sub ButtonTest_Click()" & vbCrLf Code = Code & "Call Tester" & vbCrLf Code = Code & "End Sub" 'add macro at the end of the sheet module With ActiveWorkbook.VBProject.VBComponents(ActiveSheet.Name).CodeModule .insertlines .CountOfLines + 1, Code End With End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|what Script langage can i run on Online Excel without having the installed version||3||61|
|copy a docm-file from a fixed folder location into the folder of the currently active workbook using VBA||4||24|
|any combination of this numbers||9||33|
|Excel + % to Goal when number is negative||21||25|