Re: Adding a Worksheet and Renaming


Dim mnth As String
mnth = Cells(1, 4).Text
Worksheets.Add before:=Worksheets(1), Count:=1
Worksheets(1).Name = mnth
Jim Cone
Portland, Oregon USA
(Excel Add-ins / Excel Programming)

wrote in message
I am trying to add a Working in a Macro and then renaming the
Worksheet, but Excel likes to name the Sheets 1,2,3,etc, and you don't
know what the sheet name will be to select to rename at the time you
run the Macro. The following is a simple code that I have so far:
mnth = Cells(1, 4)
Sheets("Sheet2").Name = mnth

Can anyone help me get a solution to this problem?

Relevant Pages

  • Adding a Worksheet and Renaming
    ... I am trying to add a Working in a Macro and then renaming the ... Worksheet, but Excel likes to name the Sheets 1,2,3,etc, and you don't ... Sheets.Name = mnth ...
  • Re: Manipulating date
    ... in the spreadsheet you'd enter ... the answer will be an excel date, so format the cell appropriately like ... mnth As Long) As Date ... Is not a format issue as they look typed like ...
  • Re: Excel 2007 AutoFilter problem
    ... It confirms my belief that something did change from having used the same sheets and macro for a long time in Excel 2002. ... I mention this because there is at least one known bug I have uncovered as a result of having installed that: the "Analysis ToolPak" and "Analysis ToolPak - VBA" Add-Ins switch without warning to German -- though I run Excel in English -- at some point shortly after installing Office and the Language Pack. ... Clarifying, in case it needs such -- I only apply the filter once too, if by that you mean turn on filtering. ... Oddly, I do not always have auto-filter mode turned off when I run my macro, and in fact usually do *not* have it turned off, so I would not have expected that snippet of code I showed to make any difference as to when in the sheet-generation process it shows up. ...
  • Re: How can I best "scrub" a wkbk of "phantom macros"?
    ... Although I'm not quite in the league of Excel programmers per se of Bovey and Bullen, I am darn close - well, my Mom thinks so, at least. ... If someone has an idea of how I might transfer a workbook's sheets, formulas intact, to a new one, that might do the trick. ... I've a large workbook that I've created pro bono for local public agencies. ... Problem I am having is that when loading it on a system with moderate macro security, it issues the "do you want to really do this" sort of msg, with "Enable Macros", "Eat More Burritos", etc. sort of pane. ...
  • Re: Excel Crashes When Copying Multiple Sheets in VBA
    ... Do you know why Excel has this problem? ... > is to copy sheets in groups of five or ten instead of one at a time. ... >> hitting its memory limit when using VBA code to autocopy ... >> delete multiple sheets using macro code. ...