+ Reply to Thread
Results 1 to 12 of 12

Selecting range using variable

  1. #1
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2016
    Posts
    182

    Selecting range using variable

    Hello -

    I need to set a range using a variable. Starting with A1 and looping through the first row, I want to set the column to
    variable j.

    So I need the range to be (j, 1) and then check that column for a particular string.

    Thanks

  2. #2
    Forum Contributor
    Join Date
    08-22-2011
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    516

    Re: Selecting range using variable

    something like this
    Please Login or Register  to view this content.
    with j being your variable
    Regards,
    amotto

    If I helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  3. #3
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2016
    Posts
    182

    Re: Selecting range using variable

    I'm trying this now and getting syntax error:

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    08-22-2011
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    516

    Re: Selecting range using variable

    try this
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2016
    Posts
    182

    Re: Selecting range using variable

    Getting method 'Range of Object' _Global failed

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Selecting range using variable

    is j a number or letter?
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  7. #7
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2016
    Posts
    182

    Re: Selecting range using variable

    When it stops at the breakpoint, it references column 22...its declared as Integer

  8. #8
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Selecting range using variable

    then you need to use Cells

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2016
    Posts
    182

    Re: Selecting range using variable

    That worked! Thank you!

    I looped through the column until I found "POC". Now I need to go back "j" spaces (or "j" - 1) spaces to get the name in the first column.

    Trying to do it like this:

    Please Login or Register  to view this content.
    Getting application defined error.

  10. #10
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Selecting range using variable

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2016
    Posts
    182

    Re: Selecting range using variable

    Yes!!! Thank you very much

  12. #12
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Selecting range using variable

    you're welcome

    please don't forget to mark the thread solved

+ 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