+ Reply to Thread
Results 1 to 3 of 3

Cell Selection by VBA Using Cell Value

  1. #1
    Registered User
    Join Date
    05-26-2017
    Location
    Mississippi
    MS-Off Ver
    2019
    Posts
    11

    Cell Selection by VBA Using Cell Value

    Hi,

    I have a spreadsheet that gets information added to it a couple of times each year. I want to be able to select that information, no matter how much information is added to it, and paste it into another spreadsheet. In the spreadsheet that has all of the information in it, there are two cells that have a value in each one showing how many rows and columns to select. The value for the number of columns doesn't change, but the value for the number of rows will change. I need some help to create a VBA code that uses these cell values and selects that number of rows and columns to copy and paste in another spreadsheet. For example, if the cell V1 has a value of 27 (for the number of rows to select) and cell W1 has a value of 18 (for the number of columns to select), I would like for the VBA code to use those values to select the cell range A1:R27. When another row is added, making V1 have a value of 28, the VBA code needs to select the cell range A1:R28.

    Thanks,

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    2007
    Posts
    3,083

    Re: Cell Selection by VBA Using Cell Value

    Hi Michael,

    The following will assign the range to a variable called "rngMyRange" which you can use as required (I've coded the address to appear in a message box as an example):

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Registered User
    Join Date
    05-26-2017
    Location
    Mississippi
    MS-Off Ver
    2019
    Posts
    11

    Re: Cell Selection by VBA Using Cell Value

    Hi Robert,

    Sorry I didn't respond sooner. I greatly appreciated your response. I have not had the opportunity yet to test this, but I will soon.

    Thanks again,

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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