ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creating and renaming a worksheet from user input (https://www.excelbanter.com/excel-programming/360089-creating-renaming-worksheet-user-input.html)

jonco

Creating and renaming a worksheet from user input
 
I need a macro that opens a dialog box and asks for a customer number and a
customer name and adds these two items to the bottom of a list of customers.
Then I want Excel to copy a worksheet titled "Blank" (already present in the
workbook) and rename it as the Customer Number: (Example - 2156 or
whatever they enter.)

As usual any help would be appreciated.
Jonco



somethinglikeant

Creating and renaming a worksheet from user input
 
Sub CustomerNumberAsNewSheet()
[A1].Select
Do Until IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
x = InputBox("Enter Customer Name", "Input")
y = InputBox("Enter Customer Number", "Input")
ActiveCell.Value = x
ActiveCell.Offset(0, 1).Value = y
Sheets("Blank").Select
Sheets("Blank").Copy After:=Sheets("Blank")
Sheets("Blank (2)").Name = y
End Sub

This code should give you what you need.

somethinglikeant



All times are GMT +1. The time now is 11:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com