KetanGajare
New Member
Hi I have written a simple code. Which copies Data from one sheet and paste to another sheet.
Running code from sheet1. But once the macro runs completeley the activated sheet is Sheet3. Ideally it should be sheet1. I am using Excel 2013.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Call test
End Sub
Public Sub test()
Application.EnableEvents = False
EstSheetStart = 33
EstSheetEnd = 1400
With Sheets("sheet3")
.Unprotect Password:="abc"
.Range("AN" & EstSheetStart & ":BK" & EstSheetEnd).ClearContents
Sheets("sheet2").Range("A1:AQ500").Copy
.Range("A" & EstSheetStart).PasteSpecial Paste:=xlValues
.Protect Password:="abc"
End With
Application.EnableEvents = True
End Sub
Thanks for help in advance
Running code from sheet1. But once the macro runs completeley the activated sheet is Sheet3. Ideally it should be sheet1. I am using Excel 2013.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Call test
End Sub
Public Sub test()
Application.EnableEvents = False
EstSheetStart = 33
EstSheetEnd = 1400
With Sheets("sheet3")
.Unprotect Password:="abc"
.Range("AN" & EstSheetStart & ":BK" & EstSheetEnd).ClearContents
Sheets("sheet2").Range("A1:AQ500").Copy
.Range("A" & EstSheetStart).PasteSpecial Paste:=xlValues
.Protect Password:="abc"
End With
Application.EnableEvents = True
End Sub
Thanks for help in advance