+ 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
    16

    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
    Office 365
    Posts
    3,523

    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
    16

    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)

Similar Threads

  1. Replies: 3
    Last Post: 01-19-2017, 12:44 PM
  2. Replies: 1
    Last Post: 04-16-2014, 04:10 PM
  3. Replies: 0
    Last Post: 03-20-2014, 10:57 AM
  4. [SOLVED] How to make a dropdown list cell default to blank, after another cell selection is made
    By chardsmith in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-30-2013, 03:46 AM
  5. Replies: 3
    Last Post: 04-23-2013, 07:11 PM
  6. Replies: 3
    Last Post: 09-20-2012, 03:11 PM
  7. how to prevent users able to perform cell actions except cell range selection
    By vdongen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-08-2010, 09:47 AM

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