ryancgarrett
Board Regular
- Joined
- Jun 18, 2011
- Messages
- 122
I have a form in VBA and it has some option buttons that populate a listbox when they are selected. Based on the selection in the listbox I need to copy a sheet template and rename it to the selection, as well as put the name of the selection in cell B2 of the sheet. This is my code that doesn't work... any suggestions?
Sub AddAccount()
Sheets("Account Template").Copy after:=Sheets("Trial Balance")
Sheets(2).Name = frmAddAccount.lbxAccountName.Selected
Sheets(2).Cells(2, 2).Value = frmAddAccount.lbxAccountName.Selected
Sheets("Trial Balance").Range ("B" & BlankRow("Trial Balance", 4, 2))
End Sub
Sub AddAccount()
Sheets("Account Template").Copy after:=Sheets("Trial Balance")
Sheets(2).Name = frmAddAccount.lbxAccountName.Selected
Sheets(2).Cells(2, 2).Value = frmAddAccount.lbxAccountName.Selected
Sheets("Trial Balance").Range ("B" & BlankRow("Trial Balance", 4, 2))
End Sub