+ Reply to Thread
Results 1 to 6 of 6

Cleaning up redundant code...if any

  1. #1
    Registered User
    Join Date
    08-27-2012
    Location
    raleigh, nc
    MS-Off Ver
    Excel 2007
    Posts
    13

    Cleaning up redundant code...if any

    I need help simplifying my code, if possible to simplify. I am looking to make the code do the same functionality but in less lines if possible.

    Also, I am having problems getting the "floor" to count properly. One "floor" could contain multiple FTR/IDF locations.

    Lastly, is there a way to use conditional formatting through code? I would rather write code than go through and manually set the conditions for every spreadsheet like this I create.

    Thank you in advance for any help you all will provide.
    Regards


    Please Login or Register  to view this content.

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

    Re: Cleaning up redundant code...if any

    Hi

    Couple of quick things
    1) The patch request can be
    Please Login or Register  to view this content.
    That way it will keep looping unitl it gets a correct answer, with a default answer that is valid, and you don't need the goto commands.

    2) The z=10, z=20 etc part. Either do elseif statements, or use a case statement. Much cleaner and less processing time.

    rylo

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Cleaning up redundant code...if any

    Hi AutoCadGuy,

    I trimmed a lot - see if it still works:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Registered User
    Join Date
    08-27-2012
    Location
    raleigh, nc
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Cleaning up redundant code...if any

    Rylo and xladept thank you for your quick responses.

    Rylo: If I use your statement, will there be error checking? I ask because lets say they transpose 48 into 84...how far will it loop?

    xladept: your code worked to a degree. I had k = Patch for counting and offset purposes. My offsets don't work just right so I will have to format your code to make sure that the offsets get where I need to the data to go. Thank you for showing me how to setup Subroutine calls...extremely helpful.

    While both you guys have been helpful in cleaning up the redundant code, I still have problems that need help.

    How would I write a counter for If a building has 20 floors, 2 IDFs per floor and then use my Patch and Port calculators?

    Also, is there a way to write conditional formatting for Floor 1, 2, 3... and IDF 1, 2, 3...??

    thanks again

  5. #5
    Registered User
    Join Date
    08-27-2012
    Location
    raleigh, nc
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Cleaning up redundant code...if any

    Ok, I have figured out the rest of my issues. thank you all for your help...I consider this solved.

    thanks again,

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Cleaning up redundant code...if any

    You're welcome! Glad that you figured it out!

+ 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