+ Reply to Thread
Results 1 to 5 of 5

Dynamic Range, based on user selection, used with FOR LOOP

  1. #1
    Forum Contributor
    Join Date
    07-07-2014
    Location
    ericbartha.com
    MS-Off Ver
    2016 Professional
    Posts
    126

    Dynamic Range, based on user selection, used with FOR LOOP

    Hey everyone,

    I have a UI in which the user can click 1 of 13 buttons. Each button represents a different week. Each week is stored in a seperate column, starting with E. When they click the button the week is already stored as iWeekValue (int 01 - 13). The data that needs to be check also doesn't start until Row 4.

    My question: I need help setting the range to be checked, how would I do that? Basically it needs to be E-Q4:E-Q LastRow. So if the user picks week 5 it would be I4:I LastRow.

    Hopefully that makes sense... thanks to all who reply!

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,613

    Re: Dynamic Range, based on user selection, used with FOR LOOP

    LastRow = Cells(Rows.Count,iWeekValue+4).End(xlup).Row
    Ben Van Johnson

  3. #3
    Forum Contributor
    Join Date
    07-07-2014
    Location
    ericbartha.com
    MS-Off Ver
    2016 Professional
    Posts
    126

    Re: Dynamic Range, based on user selection, used with FOR LOOP

    Hey protonLeah,

    so I set iWeekColumn = iWeekValue + 4. So I am trying to get LastRow and iWeekColumn to return a range I can run a for loop through to check for any negative values.

    But I am struggling to get the range... rngWorking = Range(iWeekColumn & BOMLastRow) --- what would be the right way to do this?

  4. #4
    Forum Contributor
    Join Date
    07-07-2014
    Location
    ericbartha.com
    MS-Off Ver
    2016 Professional
    Posts
    126

    Re: Dynamic Range, based on user selection, used with FOR LOOP

    Maybe something like
    Please Login or Register  to view this content.
    This isn't quite right though... Is it the weekend yet?

  5. #5
    Forum Contributor
    Join Date
    07-07-2014
    Location
    ericbartha.com
    MS-Off Ver
    2016 Professional
    Posts
    126

    Re: Dynamic Range, based on user selection, used with FOR LOOP

    Nevermind, I got it! Was so close....

    Please Login or Register  to view this content.
    Thanks for your help proton.

+ 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. [SOLVED] populate user form combobox based on dynamic range
    By mcdermott2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-22-2015, 09:22 PM
  2. Long range calendar with changing color based on user selection
    By jrholden in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-31-2013, 04:51 PM
  3. Dynamic Pie Chart Based on User Selection
    By mcollins789 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 03-03-2013, 06:17 PM
  4. [SOLVED] Project Timeline with Dynamic Date Range Based on User Input
    By Rollinstone12 in forum Excel General
    Replies: 2
    Last Post: 10-28-2012, 10:07 AM
  5. Dynamic named range based on data selection.
    By ObiWanBaloney in forum Excel General
    Replies: 3
    Last Post: 06-08-2012, 07:07 PM

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