Copy and paste from hidden sheet

dwool40

New Member
Joined
Apr 27, 2018
Messages
46
Office Version
  1. 365
Platform
  1. Windows
I am running the following code to copy and paste from a hidden sheet. I used macro recorder.

Rich (BB code):
Rich (BB code):
Sub test12()'
' test12 Macro
'


'
    Application.ScreenUpdating = False
    Sheets("Make Ready Board (2)").Visible = True
    Sheets("Make Ready Board (2)").Select
    Range("A2:R2").Select
    Selection.Copy
    Sheets("Make Ready Board").Select
    Range("A2:R2").Select
    ActiveSheet.Paste
    Sheets("Make Ready Board (2)").Select
    Range("G2").Select
    Application.CutCopyMode = False
    Sheets("Make Ready Board").Select
    Range("G2").Select
    Sheets("Make Ready Board (2)").Visible = False
    Application.ScreenUpdating = True

End Sub


I'm not an expert but I feel like this code can be cleaned up? Any help would be appreciated.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Would you guys mind doing another one or should I post another thread?

Code:
Sub sortready()'
' sortready Macro
'


'
    Range("A2:R71").Select
    ActiveWindow.SmallScroll Down:=-75
    ActiveWorkbook.Worksheets("Make Ready Board").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Make Ready Board").Sort.SortFields.Add2 Key:=Range _
        ("E2:E71"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortNormal
    ActiveWorkbook.Worksheets("Make Ready Board").Sort.SortFields.Add2 Key:=Range _
        ("B2:B71"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortNormal
    With ActiveWorkbook.Worksheets("Make Ready Board").Sort
        .SetRange Range("A1:R71")
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    Range("E2").Select
End Sub
 
Upvote 0
Code:
Sub sortready()
  Dim wks As Worksheet

  Set wks = Worksheets("Make Ready Board")

  With wks
    .Range("A1:R71").Sort Key1:=.Range("E1"), Key2:=.Range("B1"), _
                          MatchCase:=False, Header:=xlYes
  End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,209
Members
453,023
Latest member
alabaz

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