VBA Range declaration

bsquad

Board Regular
Joined
Mar 15, 2016
Messages
194
I am wondering if someone could provide some insight;

I am having trouble getting over the concept of ranges -

why I am having trouble with

Code:
Range(Cells(4, 3), Cells(88, 12)).Copy

and no trouble with

Code:
Range ("C4:L88").Copy


I thought I may have read somewhere where it has to do with cell qualification, but still don't get it. It drives me insane to use hardcoded values / values in between " " . I realize I could declare the Range(Cells(),Cells()) as a Range, but will have multiple declarations then. I am trying to find an alternative solution to still be able to use the top format.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
What trouble are you getting with...

Code:
Range(Cells(4, 3), Cells(88, 12)).Copy

it will copy the same as the range below.
 
Upvote 0
They should both do the same thing, as long as they are meant to work on the active sheet.
However if you are working on a non active they should be like this
Code:
With Sheets("Sheets1")
    .Range(.cells(4, 3), .cells(88, 12)).Copy
    .Range("C4:L88").Copy
End With
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,606
Messages
6,125,800
Members
449,261
Latest member
Rachel812321

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