CodePudding user response:
Sub (new)
Dim the ws As Worksheet
Dim i& , s $s1 $
S1="table already exists"
With ThisWorkbook. Sheets (" Sheet1 ")
For I=1 To.. Cells (Rows) Count, 1.) the End (xlUp). Row
S=. Cells (I, 1)
On the Error Resume Next
With ThisWorkbook. Sheets (s)
If Err. Number Then
With ThisWorkbook. Sheets. The Add (after:=ThisWorkbook. Sheets (ThisWorkbook. Sheets. Count))
.name=s
Cells (1, 1)=s
Err. Clear
End With
The Else
S1=s & amp; CRH (13) & amp; S1
End the If
End With
Next
End With
If s1 & lt;> "Table already exists" Then MsgBox s1
End Sub
CodePudding user response:
Private Sub CommandButton1_Click ()As Integer Dim a, b As String
B="Sheet1"
For a=1 To 3
Worksheets. Add after:=Worksheets (b)
ActiveSheet. Name=Worksheets (" Sheet1 "). The Range (" A "& amp; A)
ActiveSheet. Range (" A1 ")=Worksheets (" Sheet1 "). The Range (" A "& amp; A)
B=Worksheets (" Sheet1 "). The Range (" A "& amp; A)
Next a
End Sub