How to copy active sheet to another sheet in same workbook

fvisions

Board Regular
Joined
Jul 29, 2008
Messages
191
Office Version
  1. 365
Platform
  1. Windows
I have attempted a couple of variations of the code to take the full worksheet tab named "OriginalReport" and copy paste special values to a second tab labeled "Report_" but keep get various errors. I am be probably overthinking this what is your advice. I am making a command button with assigned macro for the end user.

VBA Code:
Sub OutageTrackerButton3()
'
' OutageTrackerButton3 Macro

 Dim OriginalReport As Worksheet
'Set wsOriginalReport = Sheets("Original Report")
'Set wsReport = Sheets("Report")
Set OriginalReport = ActiveWorkbook.ActiveSheet

'With wsOriginalReport
' Cells.Select
ActiveSheet.SelectedSheets.Copy
'Selection.Copy

Dim Report_ As Worksheet
Set Report_ = ActiveWorkbook.ActiveSheet

'Dim wsReport As Worksheet
'With wsReport
'Sheets("Report").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("A2").Select
With ActiveWindow
.SplitColumn = 0
.SplitRow = 1
End With
ActiveWindow.FreezePanes = True
' End With
'End With
End Sub
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
try

VBA Code:
Option Explicit

Sub OutageTrackerButton4()
Dim orr, re As Worksheet

Set orr = Sheets("OriginalReport")
Set re = Sheets("Report_")

orr.Cells.Copy
re.Cells(1, 1).PasteSpecial Paste:=xlPasteAll

End Sub
 
Upvote 0
Getting subscript out of range error, debug highlights this code line? What does orr and re mean or stand for?

VBA Code:
Set orr = Sheets("OriginalReport")
 
Upvote 0
It's a value to designate the sheet..... Are you running the code from within the same workbook with the data? If not, then precede those designations with "activeworkbook"
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,817
Members
449,049
Latest member
cybersurfer5000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top