+ Reply to Thread
Results 1 to 3 of 3

Cant select a range of cells

Hybrid View

  1. #1
    Registered User
    Join Date
    04-20-2012
    Location
    Oneida, NY
    MS-Off Ver
    Excel 2010
    Posts
    42

    Cant select a range of cells

    Can someone tell me why the following code gives me an error. I have so much trouble with ranges, I use the syntax as it is prescribed but I am missing something. Here is the code. I will include some code lines underneath since I imagine they wont work either.

     
    Sheet2.Select
    Range(Cells(R1, C1), Cells(R2, C2)).Select
        
    '
    'Paste data to report sheet
    '
        
        Worksheets("PT Monthly Report-1").Select
        Range("PTReport1Data").Select
    I eventually will be turning the range statements into copy and paste instead of select. At the moment I am using select to make sure the proper cells are being selected.

    I am also attaching my complete workbook as well. Thanks

    Dan

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Cant select a range of cells

    R1C1 syntax is for formulas only. It is invalid for VBA methods Range() and Cells(). Are you trying to select A1:B2? In which case it would simply be:
    Range("A1:B2").Select
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    04-20-2012
    Location
    Oneida, NY
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: Cant select a range of cells

    What I am doing is finding two cells that I would use to select a block of cells. The rows are constants and do not change however the starting column C1 and ending column represent a starting date and a finishing date. The columns in the spreadsheet represents dates and I want to copy the columns for a certain date range (Billing Month) and then paste them into a report worksheet which gets printed and is used to create an invoice. Since I determine the block of cells based on counting the number of days in the billing period, I have to use the cell method for determining range because it allows cells to be identified by column number and row number. If this is not the case, how can I use column numbers and row numbers to specify a block of cells.

    Dan

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA select range between cells
    By Rpporter1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-15-2013, 10:50 AM
  2. [SOLVED] Highlight range of cells - run macro - select last cell in range
    By chromachem in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-24-2012, 11:46 AM
  3. Select a range of cells and then copy them, and paste into other cells
    By Dynelor in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-24-2007, 04:03 PM
  4. How do you select a range of cells on another worksheet using the Cells property?
    By iterature in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-20-2007, 10:45 AM
  5. Compare a selected Range with a Named range and select cells that do not exist
    By PCLIVE in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2005, 03:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1