+ Reply to Thread
Results 1 to 7 of 7

Helpwith Userform syntax

  1. #1
    Forum Contributor
    Join Date
    11-03-2009
    Location
    Florida
    MS-Off Ver
    Excel 365
    Posts
    289

    Helpwith Userform syntax

    I'm hoping I can get some help with syntax, I've been striking out.
    This Userform works as intended, loading info from Sheet1 into Textboxes and loading the updated info back to the sheet.
    I'm trying to fix a few things but no joy.

    In lines 38, 39, I would like those 2 Textboxes to be disabled or dimmed unless there is data in the Textboxes in lines 23-26 (Away Address)
    I also want the Checkboxes in lines 86-88 to be disabled for the same reason (no data in lines 23-26).
    A Messagebox whenever those controls are disabled.
    Then I would like those same 3 Checkboxes to put an "X" or "" in col 31-33 instead of TRUE or FALSE.

    I'm hoping someone can help me without me having to depersonalize the whole file.
    Thanks for all the help in the past.





    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Helpwith Userform syntax

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    11-03-2009
    Location
    Florida
    MS-Off Ver
    Excel 365
    Posts
    289

    Re: Helpwith Userform syntax

    AlphaFrog,
    Almost, and I so appreciate it. Works perfectly if the address is already there when I select the LOT.
    If not, then I have enter the address info, UPDATE, and re-select the LOT.
    Is there a way to do it "on the fly", or maybe rather than disable TxtAWAYDT, clicking in it would trigger the event.
    To be clear, there is not a requirement for the AWAY address unless I am entering the AWAY DATE or the Checkboxes.
    Thanks.
    Last edited by Len Silva; 05-25-2022 at 07:13 PM.

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Helpwith Userform syntax

    Quote Originally Posted by Len Silva View Post
    AlphaFrog,
    Almost, and I so appreciate it. Works perfectly if the address is already there when I select the LOT.
    If not, then I have enter the address info, UPDATE, and re-select the LOT.
    Is there a way to do it "on the fly", or maybe rather than disable TxtAWAYDT, clicking in it would trigger the event.
    To be clear, there is not a requirement for the AWAY address unless I am entering the AWAY DATE or the Checkboxes.
    Thanks.
    I'm flying blind here without the benefit of seeing your worksheet and user form. I don't understand what that means. I don't really know what "the LOT" is or the what you are trying to do at all.

    What event are you trying to trigger?

  5. #5
    Forum Contributor
    Join Date
    11-03-2009
    Location
    Florida
    MS-Off Ver
    Excel 365
    Posts
    289

    Re: Helpwith Userform syntax

    I'm sorry, not clear.
    CBLOT is a combobox that drives everything. This is a mobile home park and the Lot number is the ID for each row of data, Names, address, phone, etc.
    The whole purpose is to create a mailing list which will use the AWAY address for the dates that the owner is away. I want to prevent the user from entering an AWAY date or the check boxes unless or until an away address is entered.
    What I think is is to make what you provided a subroutine called by clicking in the TxtAWAYDT Textbox.
    I've played around a bit but keep getting errors.
    If that's enough for you to help me, great. If not, I will depersonalize the file and post it.
    Thank you so much.

  6. #6
    Forum Contributor
    Join Date
    11-03-2009
    Location
    Florida
    MS-Off Ver
    Excel 365
    Posts
    289

    Re: Helpwith Userform syntax

    File attached
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Helpwith Userform syntax

    CBLOT_Change and TxtAWAYSTR_Exit both call the sub routine Validate_AwayAddress
    . I put it in a sub routine so you don't have to write the same code twice.

    On another note: it is bad coding practice to leave On Error Resume Next active in your code. There are legitimate reasons to use that in some instances, but it doesn't apply here. All it does is hide errors, and you won't know what the problem is and how to fix it.

    Please Login or Register  to view this content.

+ 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] Syntax error in calculations in Userform
    By knisten in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-25-2016, 05:53 PM
  2. VBA userform problem with code (syntax error)
    By Odowd in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-27-2016, 09:23 PM
  3. combining chart userform and data transfer userform into 1 userform
    By H_Kennedy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-03-2014, 12:28 PM
  4. [SOLVED] Open a userform from a userform, but preserve the info in the original userform
    By jfoerch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2013, 02:38 PM
  5. [SOLVED] VBA, MultiPage with UserForm. Syntax issue. mousemove event.
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-22-2012, 01:59 PM
  6. Userform Syntax to have textbox display Msgbox when contents left unchanged
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-01-2012, 06:25 AM
  7. Syntax for returning Optionbutton (Userform) caption (Error 438 with ctr.value)
    By asha3010 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-02-2011, 11:25 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