+ Reply to Thread
Results 1 to 5 of 5

Redefine UserForm CheckBox Click Action

  1. #1
    Registered User
    Join Date
    08-28-2017
    Location
    United Kingdom
    MS-Off Ver
    2016
    Posts
    40

    Redefine UserForm CheckBox Click Action

    I have a UserForm that comes up when I click a tab. For my own unique reasons, I need to define what happens on the CheckBox_Click function, before the Form is called -- the Action will be dependent on the outer If statement I've programmed (see below). It's the third line that I'm not having any luck with. Along with the error below, the VBA editor highlights the period between NoticeForm1 and CheckBox1; and that whole line is highlighted red.

    "Compile Error. Expected: end of statement"

    Please Login or Register  to view this content.
    The answer to this will be quite simple, I'm sure... It has to do with how I'm trying to refer to CheckBox1_Click (where CheckBox1 is an item on me NoticeForm1).

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Redefine UserForm CheckBox Click Action

    Interesting....I've never seen a procedure created within a procedure. Are you able to upload the workbook?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    08-28-2017
    Location
    United Kingdom
    MS-Off Ver
    2016
    Posts
    40

    Re: Redefine UserForm CheckBox Click Action

    I had a feeling that was going to be your response, but I mean -- in this case, SURELY the workbook adds nothing. This is entirely about how to define the action of with a CheckBox in a UserForm, outside the UserForm Code.

    I really can't provide the workbook here. But I thought I'd framed the problem such that the workbook is irrelevant. The code block is the important bit.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Redefine UserForm CheckBox Click Action

    As long as the userform is live (and it can be hidden) then you don;t need to be IN the userform to address the objects.

    If you have time to mock up a simple example based on your workbook I'm happy to take a look.

  5. #5
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Redefine UserForm CheckBox Click Action

    You can’t do that directly, why can’t you put the if clause within the click event handler of the checkbox? You can just pass a property to the UserForm then and switch in the click handler.

    If that doesn’t work for you, then could you give us a bit more context? Your architecture doesn’t seem right for the VBA way of doing things, though it’s hard to make recommendations without some background

+ 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] Assign Click Action to Dynamic Button on Userform
    By me_bee in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-17-2018, 05:51 PM
  2. [SOLVED] Make Worksheet Active-X CheckBox value same as Userform CheckBox value
    By L plates in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-21-2016, 08:23 AM
  3. Get UserForm checkbox caption and pass to another UserForm on click or mouse down
    By tulsaguy71 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-08-2013, 11:07 AM
  4. Using double-click on mouse to perform an action?
    By mgarcia in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-19-2009, 12:52 AM
  5. hiding cell content until a click action
    By excel77 in forum Excel General
    Replies: 7
    Last Post: 11-12-2008, 11:52 AM
  6. Group Action of CheckBox Control in Excel 2000
    By Dan Fisher in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-02-2005, 06:05 AM
  7. How to 'Click and then perform action'
    By chris100 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 08-02-2005, 09:57 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