Sunday, 15 July 2012

excel - Create new sheets based on a list -


When I create a new sheet based on the VBA code below, it works as I want, but a small There is a problem. The issue is that when creating all the sheets based on the list given in the column ("A") , then they make another sheet with the same name as the original one and also an error in the code In this section,

  ActiveSheet.Name = c.value  

is correct to any assistant.

  Private Sub Command Button 1_Click () Error Resume Next App. Enabled competent events = incorrect oval down the form A below the A = range ("A" and rows.Count). End (XLEP). As the range dim, for each C range worksheet ("A2: A" and below A) set ws = nothing on the resume start again, go to the next set ws = worksheet (c.value) error 0 If the ws is nothing then the sheet ("format"). Select Sheet ("Format"). Copy: = Sheets (Sheets.Count) ActiveSheet.Name = c.Value End if the next application. EnableEvents = True End Sub  

I think you have forgotten in your statement that If there is a limit on which worksheet, then that line should be something like this:

For each C in worksheet (1) Range ("A2: A" and "A")

In addition to this, there is no other issue in your code, I have just started writing again.

  Private sub-commandbutton 1_Click () dim the Range dim form worksheet in the form of a downgraded error as the GoTo eh error. EnableEvents = False bottomA = Range ("A" and Rows.Count). (XlUp). Rows for each C in worksheets (1). Reset the range ("A2: A" and A) 'set YS = nothing' to 'Error' set up ws = worksheets (C.well) 'Get on goto 0' if none, Sheets (" Format "). Choose Sheets ("Format"). Copy: = Sheets (Sheets.Count) Activites .name = C Value 'if the next app is finished. Enable Abstract = True Nickel Sub Eh: Debug Print "" debug. Print Error Description message (error description) ending sub  

No comments:

Post a Comment