How to select ranges from multiple rows

iand5

New Member
Joined
Jul 26, 2017
Messages
36
I want to copy the same thing into different rows in Excel. How can I simplify the code below so I can select multiple ranges?

<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">Windows("Schedule.xlsx").Activate
Sheets
("QF.IPP").Select
Range
("E10:K10").Select
Application
.CutCopyMode = False
Selection
.Copy
Windows
("ID_DOG.xlsm").Activate
Range
("B47:G47").Select
ActiveSheet
.Paste

Windows
("Schedule.xlsx").Activate
Sheets
("QF.IPP").Select
Range
("E10:K10").Select
Application
.CutCopyMode = False
Selection
.Copy
Windows
("ID_DOG.xlsm").Activate
Range
("B48:G48").Select
ActiveSheet
.Paste</code>
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
I want to copy the same thing into different rows in Excel. How can I simplify the code below so I can select multiple ranges?

<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">Windows("Schedule.xlsx").Activate
Sheets
("QF.IPP").Select
Range
("E10:K10").Select
Application
.CutCopyMode = False
Selection
.Copy
Windows
("ID_DOG.xlsm").Activate
Range
("B47:G47").Select
ActiveSheet
.Paste

Windows
("Schedule.xlsx").Activate
Sheets
("QF.IPP").Select
Range
("E10:K10").Select
Application
.CutCopyMode = False
Selection
.Copy
Windows
("ID_DOG.xlsm").Activate
Range
("B48:G48").Select
ActiveSheet
.Paste</code>
What is the name of the sheet in ID_DOG.xlsm that those ranges are on?
 
Last edited:
Upvote 0
I did something somewhat similar.

Code:
Workbooks("Schedule.xlsx").Sheets("QF.IPP").Range("E10:K10").Copy
    Workbooks("ID_DOG.xlsm").ActiveSheet.Range("B30:H53").PasteSpecial
 
Upvote 0
I did something somewhat similar.

Code:
Workbooks("Schedule.xlsx").Sheets("QF.IPP").Range("E10:K10").Copy
    Workbooks("ID_DOG.xlsm").ActiveSheet.Range("B30:H53").PasteSpecial
If you are writing to the ActiveSheet in ID_DOG.xlsm, then I think this should work...
Code:
With Windows("Schedule.xlsx").Sheets("QF.IPP").Range("E10:K10")
  .Copy Windows("ID_DOG.xlsm").ActiveSheet.Range("B47:G47")
  .Copy Windows("ID_DOG.xlsm").ActiveSheet.Range("B48:G48")
End With
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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