+ Reply to Thread
Results 1 to 13 of 13

neat fix to a gross line of code?

  1. #1
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    neat fix to a gross line of code?

    Hey guys,

    Can someone help make the below better?

    Please Login or Register  to view this content.
    I really hate this line of code. I would love it if I was able to feed a list of entries when I begin the code, rather then type each of them out like this.
    Anyone got an neat fixes?


    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: neat fix to a gross line of code?

    Is it
    Please Login or Register  to view this content.
    ?

  3. #3
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: neat fix to a gross line of code?

    Hi Jimmy, this may not be what you're after, but at least it's shorter:
    Please Login or Register  to view this content.
    Please click the Add Reputation star below any helpful posts, and if you have your answer, mark your thread as SOLVED (Thread Tools up top). Thanks!-Lee
    Last edited by leelnich; 06-22-2017 at 02:47 AM.

  4. #4
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    Re: neat fix to a gross line of code?

    Quote Originally Posted by jindon View Post
    Is it
    Please Login or Register  to view this content.
    ?

    Almost works except. except Trim doesn't remove hard spaces.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: neat fix to a gross line of code?

    In that case it is not space.
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    Re: neat fix to a gross line of code?

    Quote Originally Posted by jindon View Post
    In that case it is not space.
    Please Login or Register  to view this content.
    Haven't used "Like" before. I will play around with it. Thanks


    Any ideas how I could do the following:
    Eg1) User puts in "AR", "pre-start", "1y", "6m"

    So something that makes the line look like:
    Please Login or Register  to view this content.

    Eg2) User puts in "pre-start", "1y", "6m"

    So something that makes the line look like:
    Please Login or Register  to view this content.
    How would I go about doing that, for an indefinite number of user imputs.

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: neat fix to a gross line of code?

    How do user inputs those string?

  8. #8
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    Re: neat fix to a gross line of code?

    hey Jindon,

    Below is how users will input:

    Please Login or Register  to view this content.

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: neat fix to a gross line of code?

    See if this is how you wanted.
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    Re: neat fix to a gross line of code?

    Hey Jindon,

    Thanks for the help. This is what I ended up with:
    I'm going to play around with your solution in a bit, see if I can learn anything.

    My solution:
    Please Login or Register  to view this content.

    I'm hoping to make the program Ask if they user wants to run the program more then once and accept all the inputs at the very start before it has started running. I think I would need a loop around the following bit of code:

    Please Login or Register  to view this content.
    ***I think I would need a loop and to change my variables to arrays or 2 dimensional collections? I'm not sure how to go about doing that.****

    Let me know what you think.

    Jimmy.
    Last edited by JimmyWilliams; 06-23-2017 at 06:12 AM. Reason: Added more to the question.

  11. #11
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    Re: neat fix to a gross line of code?

    Also

    Whenever I run this line:

    Please Login or Register  to view this content.
    The inputbox has "D:D" in it, why isn't it showing "C4"? What is wrong?


    Thanks,
    Jimmy

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: neat fix to a gross line of code?

    Can you upload a workbook?

    I don't understand the reason why you need to sort the collection etc...

  13. #13
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    Re: neat fix to a gross line of code?

    Quote Originally Posted by jindon View Post
    Can you upload a workbook?

    I don't understand the reason why you need to sort the collection etc...
    I managed to get this all working.

    The "sort collection" part, was so I could have everything alphabetical, and also have similar entries next to each other in the collection, so I could removed them and result in a unique list.

    I had to do a second "sort collection" that made sure that the longest strings where searched for first and then the shortest, to prevent accidently having my information go into the wrong category (if the string of the shorter is also found within the longer string, would result in errors).

    Anyways, thanks for your help!

    Jimmy

+ 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. Derive Gross Pay plus Payroll Taxes from a Gross Amount
    By JackJack185 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 05-09-2017, 03:56 PM
  2. VBA code to copy line items from form - overriding previous line item
    By dkostyan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-30-2016, 11:19 AM
  3. [SOLVED] How to write code so its easy to read (make it neat)
    By Decar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-17-2013, 05:03 AM
  4. Paste Special Add Value - Neat Code?
    By delfi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-22-2010, 10:41 AM
  5. Neat way of reworking an Addin.
    By cablesforless in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-01-2006, 11:54 AM
  6. [SOLVED] Writing neat code
    By Roderick O'Regan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-30-2005, 08:45 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