Selection.Paste Please tell me whst is the error in this code and how it can be corrected.

vroom547

New Member
Joined
Jul 23, 2020
Messages
13
Office Version
  1. 2013
Platform
  1. Windows
Sub Macro1()

'

' Macro1 Macro

'

' Keyboard Shortcut: Ctrl+q



Range("F11:F36").Select

ActiveWindow.SmallScroll Down:=12

Range("F11:F36,F40:F48").Select

Range("F48").Activate

ActiveWindow.SmallScroll Down:=15

Range("F11:F36,F40:F48,F52:F53,F57:F61").Select

Range("F61").Activate

ActiveWindow.SmallScroll Down:=15

Range("F11:F36,F40:F48,F53:F57,F57:F61,F65:F66").Select

Range("F66").Activate

Selection.Copy

Windows("T-4 (2024 25) Qualification Spreadsheet").Activate

Sheets("Participants Data").Select

Range("A100000").End(xlUp).Select

ActiveCell.Offset(1, 0).Range("A2").Select

Selection.Paste Special Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _

:=False, Transpose:=True

End Sub
 
Ok, try
VBA Code:
Sub vroom()

   Range("F11:F36,F40:F48,F53:F61,F65:F66").Copy
   With Windows("T-4 (2024 25) Qualification Spreadsheet.xlsm").Sheets("Participants Data")
      .Range("A" & .Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues, , , True
   End With
End Sub
 
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
error on this
VBA Code:
With Windows("T-4 (2024 25) Qualification Spreadsheet").Sheets("Participants Data")
 

Attachments

  • error.JPG
    error.JPG
    75.4 KB · Views: 7
Upvote 0
Oops, that should be
VBA Code:
       With WorkBooks("T-4 (2024 25) Qualification Spreadsheet.xlsm").Sheets("Participants Data")
 
Upvote 0
Oops, that should be
VBA Code:
       With WorkBooks("T-4 (2024 25) Qualification Spreadsheet.xlsm").Sheets("Participants Data")
I forgot to tell you that i ran the code with .xlsm and without .xlsm but getting same error.

Runtime error 9.
Subscript out of range.
 
Upvote 0
In that case either the workbook name or the sheet name is wrong.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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