I have searched the internet for four days now and still cannot find a proper solution to my problem. I have a sheet called "Home." From this sheet I have a command button that creates a new sheet titled with the value in cell B3 which is "Oct". With the same command button, I have created a command button in the sheet "Oct." With the same command button on the "Home" sheet, I want to give the new command button in the "Oct" sheet code. Here is what I have:
Private Sub CommandButton4_Click()
Sheets("New").Cells.Select
Selection.Copy
Set NewSheet = Sheets.Add(Type:=xlWorksheet)
NewSheet.Name = Range("B3").Value
ActiveSheet.Paste
With NewSheet
ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=True, DisplayAsIcon:=False, Left:=800, Top:=50, Width:=100, Height:=30).Select
End With
End Sub
This code gives me the sheet "Oct" with a command button. I want this command button to automatically have code once it is made.
Thanks to anyone that can help.
Bookmarks