+ Reply to Thread
Results 1 to 11 of 11

Code running slow

  1. #1
    Registered User
    Join Date
    10-08-2007
    Posts
    33

    Code running slow

    I have had lots of help with this code, and now have a userform that does everything I want it to, but it seems suddenly very slow. Could anyone take a look and see if I need to do anything to speed things up?

    Also, what would I do to make sure there were no spaces around the Surname and Initial entries in the text boxes?

    Please Login or Register  to view this content.
    Thank you in advance!

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    I do not understand the logic of having the For Each loop inside a Do loop
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Registered User
    Join Date
    10-08-2007
    Posts
    33
    I don't know, I was just told to put that code in when I asked for help.

    I am very new to VBA, and am learning slowly.

    Any suggestions?

  4. #4
    Registered User
    Join Date
    10-08-2007
    Posts
    33
    bump for any suggestions in streamlining code better, or reassurance that the code is ok as it is

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    This Function checks if a worksheet exists. Place it in a Standard Module

    Please Login or Register  to view this content.
    Use it in your code to avoid the loops

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    Registered User
    Join Date
    10-08-2007
    Posts
    33
    Thank you, Roy - have just logged on and seen your reply. Will adjust code accordingly.

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I haven't tested it so let us know if it speeds up.

  8. #8
    Registered User
    Join Date
    10-08-2007
    Posts
    33
    Have to say it doesn't seem to improve things.

    I think the noticable difference came when I added the code to format everything into Proper case. I also added extra lines of code at that time to put the textbox entries in three places instead of two. The trouble is, I do need it to do that. Is there something there that is a long-winded way of doing things?

    I am just concerned that if it is slow on my brand new laptop using Excel 2007, then I dread to think what it will be like on the old computer my husband uses at work using Excel 2000.

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Why not use UCase instead of StrConv?

    Also if you want to lose spaces take a look at the Trim function.

  10. #10
    Registered User
    Join Date
    10-08-2007
    Posts
    33
    Is UCase not upper case? I want to just capitalise the Surname and initial's first letters.

    How would I use the Trim function?

    Sorry, quite new to all this.

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Doh!

    Totally forgot about the vbProperCase(=3) constant for the 2nd argument of StrConv.

+ 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