+ Reply to Thread
Results 1 to 4 of 4

Help Simplify Long Select Case with If/Then

  1. #1
    Forum Contributor
    Join Date
    07-28-2009
    Location
    Orange County, CA
    MS-Off Ver
    Excel 2007
    Posts
    115

    Help Simplify Long Select Case with If/Then

    I would like to see how this can be simplified or what other methods can be used to achieve the same Goal

    Please look at the Macro PlayerStat() in Module1
    It is too long for me to post the macro in Code Brackets.. sorry.

    If there is a different way, like to select the value in the selected range and cross reference it against a list. i'm not sure... trying to learn and be efficient.

    Thanks in advance.
    Attached Files Attached Files
    Last edited by garretonufer; 09-30-2009 at 11:57 AM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Help Simplify Long Select Case with If/Then

    Hi

    Didn't test this, but you could do something like

    Please Login or Register  to view this content.
    This will replace the entire PlayerStat code.

    Some comments
    1) Do not use cell as a variable as it is a reserved word in VBA. I've cut it down to ce
    2) I've used the find statement to find the appearance of the player in the range being evaluated for the current week, in the output range. - variable findit
    3) I then use the offset from that range variable to perform the updates
    4) In the first block, it updates the column J result
    5) In the second block, it uses the competitor SL value as the basis for the offset. If you look at your outputs, it is a function of the SL value by 2 to determine the Total column, and the same function minus 1 to get the Win column for that SL value.
    6) Another way to determine the output columns would have been to use match of the SL value against Standings!15:15.

    HTH

    rylo

  3. #3
    Forum Contributor
    Join Date
    07-28-2009
    Location
    Orange County, CA
    MS-Off Ver
    Excel 2007
    Posts
    115

    Re: Help Simplify Long Select Case with If/Then

    I understand the majority of the logic here, and it's right in line with what i was originally thinking however, i'm having issues getting the points Sheets("Standings").Range("J4:J11") {findit.Offset(0,6) <-- which actually needs to be findit.Offset(0,7)}

    Please Login or Register  to view this content.
    So what i need to have happen is
    findit.Offset(0,7) to increase by the value of ce.offset(0,4) only when
    ce.Offset(0,3) .Value= "W"

  4. #4
    Forum Contributor
    Join Date
    07-28-2009
    Location
    Orange County, CA
    MS-Off Ver
    Excel 2007
    Posts
    115

    Re: Help Simplify Long Select Case with If/Then

    nevermind Gents. I figured it out,
    I threw an if statement in as follows:
    Please Login or Register  to view this content.

+ 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