VBA Code to Copy Data to Another Worksheet in Excel

This code copies the selected range and pastes it to another worksheet.

VBA Code:

Sub CopyToAnotherWorksheet()
    Dim sourceRange As Range
    Dim destinationSheet As Worksheet
    
    Set sourceRange = Selection
    Set destinationSheet = Worksheets("Sheet2")
    
    sourceRange.Copy destinationSheet.Range("A1")
End Sub
Join Our Telegram Group techguruplus telegram group Join Our WhatsApp Group techguruplus whatsapp group

Leave a Comment