+ Reply to Thread
Results 1 to 7 of 7

Shorter VBA code, help

  1. #1
    Registered User
    Join Date
    05-09-2017
    Location
    Ostrava
    MS-Off Ver
    2016
    Posts
    36

    Question Shorter VBA code, help

    Hi!

    Can anyone please help me write a shorter vba code?

    This vba code I need for editing futsal players records.

    That vba code works well, but it's too long.

    The code below is for 2 teams, but I have in league 10 team, so I would like a better solution.

    Thank you in advance for your help.

    Kind Regards
    --Daniel

    Snap 2017-11-23 at 12.15.24.png

    more in enclosed files

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Shorter VBA code, help

    Hi,

    You could replace your code with this
    Please Login or Register  to view this content.
    Hopefully you can see the pattern to extend the code for the other teams.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Registered User
    Join Date
    05-09-2017
    Location
    Ostrava
    MS-Off Ver
    2016
    Posts
    36

    Re: Shorter VBA code, help

    Thank you for help, I know how this code extend for the other teams.

    This vba code do something what is undesirable, but I cannot modify it...

    For example, If you delete text from the txtBox 9 and 10 after that save with CommandButton1, so in sheet2 will be added player with duplicate values (name and date).

    In my veryyy long code it worked well.

    Do you know how to fix it? - for adding players and deleting players?

  4. #4
    Registered User
    Join Date
    05-09-2017
    Location
    Ostrava
    MS-Off Ver
    2016
    Posts
    36

    Re: Shorter VBA code, help

    Quote Originally Posted by xlnitwit View Post
    Hi,

    You could replace your code with this
    Please Login or Register  to view this content.
    Hopefully you can see the pattern to extend the code for the other teams.
    Thank you for help, I know how this code extend for the other teams.

    This vba code do something what is undesirable, but I cannot modify it...

    For example, If you delete text from the txtBox 9 and 10 after that save with CommandButton1, so in sheet2 will be added player with duplicate values (name and date).

    In my veryyy long code it worked well.

    Do you know how to fix it? - for adding players and deleting players?

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Shorter VBA code, help

    Oh, I didn't see the Worksheet_Change code you have. Change the output routine to clear the range as your old code did
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    05-09-2017
    Location
    Ostrava
    MS-Off Ver
    2016
    Posts
    36

    Re: Shorter VBA code, help

    Quote Originally Posted by xlnitwit View Post
    Oh, I didn't see the Worksheet_Change code you have. Change the output routine to clear the range as your old code did
    Please Login or Register  to view this content.
    Thank you very much.

    Thats final code...

    Please Login or Register  to view this content.

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Shorter VBA code, help

    You can shorten that a little further like so
    Please Login or Register  to view this content.
    since the column patterns are every second column from 1.

+ 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] shorter version of this code
    By aarona in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-20-2017, 01:46 AM
  2. Shorter code with error?
    By Lsxtrkiller in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-19-2016, 09:14 PM
  3. Use a shorter code
    By tax112 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-20-2015, 02:54 AM
  4. [SOLVED] How can I make this code shorter by using a loop. or there's any easier shorcuts code
    By romarkevinruiz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-10-2014, 08:53 AM
  5. [SOLVED] Trying to change verbose looping code into more efficient (and shorter) code please
    By dawatcher in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-03-2013, 07:43 AM
  6. making code shorter
    By hvalhund in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-06-2011, 11:58 AM
  7. Make code shorter
    By Aquila in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-17-2010, 11:09 PM

Tags for this Thread

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