I am newbie at VBA and have a problem to solve, which for you will be more than simple, I am sure. Here is the problem:
I have table with company names in column A. What I want is to select cell with company name, click the button which will run a macro creating new sheet based on template, and rename the newly created sheet with name of the selected cell in Sheet1 (company name).
The macro generally works, I have only problem with renaming it. Your help will be greatly appriciated. Also any comments on my code in general will be very useful. Here is the code:
Sub NewSheet()
Dim wb As Workbook
Dim ws As Worksheet
Dim activeWB As Workbook
Dim FilePath As String
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
Set wb = Application.Workbooks.Open(FilePath)
wb.Worksheets(1).Copy After:=activeWB.Sheets(activeWB.Sheets.Count)
activeWB.Activate
ActiveSheet.Name = Worksheets("Arkusz1").ActiveCell.Value
wb.Close False
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub