+ Reply to Thread
Results 1 to 10 of 10

Code need to be shorten up and also include inputbox

  1. #1
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Code need to be shorten up and also include inputbox

    HI I have below code which works but not so nice. I change date format in named sheets in different columns. I would like to if the code can be shorten down. And also I would really like to have an input box so I can set the same range in all sheet, depends what I need. now in below example it goes from row 9 to 600 in every sheet. So would like to be able to set this not individual but for all sheets with an input box. If I should use another option its to be able to select the used range, but there can be blanks for sure.

    Please have a look here is my long code, hope some can help with that.

    Sincerely
    Abjac

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Code need to be shorten up and also include inputbox

    The select statements all do the same, so set this up as a sub routine, but passing in the sheet name,

    so

    Please Login or Register  to view this content.
    You could even put the formatting as a gosub/return in the sub to as they are identical
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Code need to be shorten up and also include inputbox

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Code need to be shorten up and also include inputbox

    HI Nathansav. Yes but its different sheets in your example you mention sheetname. How do I make one code shorter for all sheets and how to be able to set the range in all with an inputbox? Maybe I just don't know what you mean. Please try explain.

    thanks

    Abjac

  5. #5
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Code need to be shorten up and also include inputbox

    Please Login or Register  to view this content.
    so T("IT")

  6. #6
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Code need to be shorten up and also include inputbox

    HI John this is exactly what I would like to have. But it gave me and error in this below line. Object doesn't support this property or method. I use excel 2003 don't know if that means some. But your code is really what I would love to have. Please have a look thanks


    Please Login or Register  to view this content.
    Abjac

  7. #7
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Code need to be shorten up and also include inputbox

    HI Nathensav . Yes I know that but that means I need to make a code for every sheet, so more or less the same as before?

    Thanks
    Abjac

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Code need to be shorten up and also include inputbox

    Try:

    Please Login or Register  to view this content.
    Last edited by JOHN H. DAVIS; 09-05-2014 at 07:29 AM.

  9. #9
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Code need to be shorten up and also include inputbox

    HI John this one is really brilliant it works perfect. Thanks allot for this great code.
    Thanks to you also nathansav.

    Have a nice day both

    Sincerely
    Abjac

  10. #10
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Code need to be shorten up and also include inputbox

    You're welcome. Glad to help out and thanks for the feedback.

+ 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. please help shorten this code
    By newbiewexcel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-22-2013, 11:38 PM
  2. [SOLVED] How to Include Userform for Inputbox in VBA
    By Rajeshkumar R in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-11-2013, 04:29 AM
  3. [SOLVED] Very inefficient code because of different sizes of arrays, how do i shorten my code?
    By Brammer88 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-28-2012, 04:49 PM
  4. How can I shorten this VBA code?
    By hemi_fan in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2010, 11:53 AM

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