Selecting a range with a variable row

FawnCC

New Member
Joined
Mar 29, 2013
Messages
19
Ok, this isn't working like I expected it to.

I want to copy a range where the row is variable (i in the Loop I'm doing) but the columns stay the same. What am I doing wrong?

Workbooks("Labor Info").Sheets("Transfer").Range("A" & i & ":E" & i).Select
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Well, you're not actually trying to COPY anything with that line of code..
It's SELECTING it.

You don't need to select something to copy it.
And your error is probably being caused by the Sheet Transfer in the book Labor Info is not currently active.
You can't select a range on a Sheet that is not currently active.

Try
Workbooks("Labor Info").Sheets("Transfer").Range("A" & i & ":E" & i).Copy

Then of course you need to Paste it somewhere, right?

Try something Like
Workbooks("Labor Info").Sheets("Transfer").Range("A" & i & ":E" & i).Copy Destination:= Workbooks(....).Sheets(...).Range("A1")
 
Upvote 0

Forum statistics

Threads
1,213,492
Messages
6,113,967
Members
448,537
Latest member
Et_Cetera

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