Hello!
Im having a bit of a problem with my code, and it might be very easy for you. Im very new at this.
Problem: I want a commandbutton that create new worksheets. The new worksheets gets its name from the value in CELL B12.
And when it have created the new worksheet, it should copy a range of cells from the mainsheet called "Indata" and paste it in the new sheet.
Code
Private Sub CommandButton1_Click()
Dim a As String
a = ActiveSheet.Cells(12, 2).Value
Sheets.Add After:=Sheets(Sheets.Count)
ActiveSheet.Name = a
Range("A1:J30").copy Worksheet("a").Range("A1")
End Sub
It works with creating the new sheet, but wont paste the data.
Im having a bit of a problem with my code, and it might be very easy for you. Im very new at this.
Problem: I want a commandbutton that create new worksheets. The new worksheets gets its name from the value in CELL B12.
And when it have created the new worksheet, it should copy a range of cells from the mainsheet called "Indata" and paste it in the new sheet.
Code
Private Sub CommandButton1_Click()
Dim a As String
a = ActiveSheet.Cells(12, 2).Value
Sheets.Add After:=Sheets(Sheets.Count)
ActiveSheet.Name = a
Range("A1:J30").copy Worksheet("a").Range("A1")
End Sub
It works with creating the new sheet, but wont paste the data.