+ Reply to Thread
Results 1 to 6 of 6

Excel 2007 : VBA help

  1. #1
    Registered User
    Join Date
    03-31-2011
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    11

    VBA help

    I have some spreadsheets that need updating. I have a macro that can pull the data if I input the range manually but I was hoping to get it to pull based on a cell value as I need this to work for different values.

    Cell A15 in MySheet has the value. I want it to generate a range to use later in the macro, MyRange so that if the value of A15 was 4 I would get the range to be "A1:A4"

    Any ideas?


    Please Login or Register  to view this content.
    Last edited by pike; 03-31-2011 at 04:58 PM. Reason: add code tags for newbie PM Rule

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,252

    Re: VBA help

    Please note that you should put CODE Tags around your code. The Forum Moderators are quite strict about following the forum rules ... and this is one of them.

    Assuming you do that, try this:

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.



    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    03-31-2011
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: VBA help

    That worked!! Thank you

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: VBA help

    They're pretty strict about vague thread titles, too. As explained in Rule #1.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,252

    Re: VBA help

    @kmkelley: thanks for the feedback. And thanks for adding the Code Tags

    Cutter makes a good point which I should really also have mentioned.

    That said, it's sometimes difficult to know how to word it.

    Maybe something like: "How to use a variable in a VBA range statement"

    Regards

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA help

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    PLEASE PM WHEN YOU HAVE DONE THIS AND I WILL DELETE THIS POST
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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