Link to home
Create AccountLog in
Avatar of peispud
peispudFlag for Canada

asked on

Set a range to another worksheet using R1C1 format

Hi.

I am having problems getting this right.    Thank you for your help.

    Dim ws As Worksheet:  Set ws = Worksheets("MySheet")
    Dim CCC As Range
    Set CCC = Range(Cells(1, 1), Cells(1, 7))                       ' Seems OK
    Set CCC = Range(ws.Cells(1, 1), ws.Cells(1, 7))                 ' Computer gets angry

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj)
Flag of India image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
What worksheet are you using in line 3?  Is MySheet the current sheet, or something else?  The range depends on the worksheet, so the syntax would be like this:

   strRange = "A7:A10"
   Set rngPipeline = shtPipeline.Range(strRange)
   rngPipeline.Select

Open in new window

Avatar of peispud

ASKER

Perfect!!    Thank all for helping.
You're welcome. Glad to help.