Andrew
Andrew

Reputation: 1

VBA Copying text from one worksheet to active worksheet

Sorry for the basic question, but much googling only gave me complicated answers. On the click of a button I am making a copy of another worksheet, I need to copy some text from the first worksheet to this newly created worksheet on the same button click (who's name may differ I.e. sheet1 (1), sheet1 (2). I'm sure it's very simple referencing the active sheet, help appreciated.

 Private Sub CommandButton2_Click()
 ActiveWorkbook.Sheets("AUTHORITIES VISIT").Copy _
 after:=ActiveWorkbook.Sheets("CREATE REPORT")
 End Sub 

Upvotes: 0

Views: 571

Answers (1)

Kᴀτᴢ
Kᴀτᴢ

Reputation: 2176

You can also have a look at the macro recorder and try it by your own.

This code should work for you:

Sub test()
Sheets("AUTHORITIES VISIT").Copy After:=Sheets("CREATE REPORT")
ActiveSheet.Cells(14, 3).Value = Sheets("CREATE REPORT").Cells(8, 2)
End Sub

As I understand from your comments above it copies the sheet "AUTHORITIES VISIT" after the sheet "CREATE REPORT" and copy from "CREATE REPORT" cell "B8" into the new sheet cell "C14"

Upvotes: 0

Related Questions