+ Reply to Thread
Results 1 to 3 of 3

Requesting a review of my UserForm code, and one slight problem

  1. #1
    Registered User
    Join Date
    12-08-2007
    Posts
    32

    Requesting a review of my UserForm code, and one slight problem

    Hi all,

    I'm new and have been hacking together a userfrom from a video I saw on youtube, with a few minor twists. It's pretty simple, it just adds values to the table when I hit enter, and when I hit the "clear button" it repopulates the first field with the current month so its ready to go for more inputs. Its working fine for one exception 1. I don't know if its coded backwards-assed but works, and 2, the "tab" button doesn't select the next field, I have to manually click it.

    The Userform pops up under Developer>Macros "Call CallUserFrom"

    Any input would be appreciated, thanks!


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by juanzo007; 01-31-2021 at 08:45 AM.

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Requesting a review of my UserForm code, and one slight problem

    Nothing much wrong with the code, other than it not being well indented. Indentation makes code much easier to read.
    Code slightly rewritten below. Only real thing I changed is rather than having two loops I've just condensed them into one So each control is stamped to the worksheet then cleared before it moves to the next control.

    Also, you don't really need the clear button. I've added a couple of lines that will quickly close and reopen the form which will set it back to it's original state, i.e. cleared and with the current month in the first control.
    This means you don't actually need to clear the control in the loop, so if you scrap the clear button you can remove the second command in the loop.

    Or if you prefer to keep the clear button the Unload Me and the UserForm3.Show lines.

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

  3. #3
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Requesting a review of my UserForm code, and one slight problem

    I forgot to say, the tab key was moving to a different control, just not the "next" control.
    To solve that right click on a blank area of the form and selecting "Tab order". That brings up a box where you can change the order of the controls and that will dictate which one the cursor moves to (set focus on) when you press tab.
    I put them in order in the attached.

    BSB

+ 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] Slight problem with stuff not disappearing when it should...
    By Drayde in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 03-14-2014, 04:17 PM
  2. [SOLVED] Slight problem with Arrays Formula
    By helpbitte in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-12-2013, 10:14 AM
  3. [SOLVED] Slight code adjustment please
    By dannac in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-06-2012, 04:36 PM
  4. Slight problem
    By Glenn Kilpatric in forum Excel General
    Replies: 3
    Last Post: 10-22-2006, 05:57 AM
  5. Slight prob with this code
    By simonsmith in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2006, 09:45 AM
  6. [SOLVED] Slight problem - routine to add quotes to a column
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-15-2005, 11:05 AM
  7. [SOLVED] Slight Problem
    By Nick in forum Excel General
    Replies: 1
    Last Post: 06-29-2005, 11:54 AM
  8. [SOLVED] Slight problem automating Excel in a service
    By someone in forum Excel General
    Replies: 2
    Last Post: 05-13-2005, 05:06 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