Converting this below code into an if statement.
For example: If Sheet2 is not exist, code will copy data from Sheet1 and create sheet2 then will paste data in Sheet2 and will return to Sheet1.
If Sheet2 is exist then Nothing.3
Any help you could provide would be much appreciated
When i run this code again it gives error If Sheet2 is already exist then it should return nothing
For example: If Sheet2 is not exist, code will copy data from Sheet1 and create sheet2 then will paste data in Sheet2 and will return to Sheet1.
If Sheet2 is exist then Nothing.3
Any help you could provide would be much appreciated
When i run this code again it gives error If Sheet2 is already exist then it should return nothing
Code:
Sub sheet()
Dim Destination As Worksheet
Set Destination = Worksheets.Add(After:=Worksheets("Sheet1"))
Destination.Name = "Sheet2"
Sheets("sheet1").Range("A:D").Copy Sheets("sheet2").Range("A:D")
Sheets("Sheet1").Select
Range("A1").Select
End Sub
Last edited: