Consulting

Results 1 to 3 of 3

Thread: Solved: How to specify range using contents of cells?

  1. #1

    Solved: How to specify range using contents of cells?

    Here is code I have been trying:

    Let beginrow = Cells(3, 19)
    Let endrow = Cells(4, 19)
    Range("A1").Select
    ActiveCell.Offset(0, 0).Range("A" + beginrow + ":J" + endrow).Select

    beginrow represents the number of the row in the spreadsheet from which I want to specify a range for copying. endrow is the endrow number for the range to be copied. There is an error on the 4th line. I believe I am using the wrong syntax, but I don't know what it should be.

    How can I do this?

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    [vba]
    Dim BeginRow As Long, EndRow As Long
    BeginRow = Cells(3, 19)
    EndRow = Cells(4, 19)
    Range("A" & BeginRow & ":J" & EndRow).Select
    [/vba]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    Works like a charm.

    Thank you so much.

Posting Permissions

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