+ Reply to Thread
Results 1 to 6 of 6

Macro Excel: Assigning Macro to User form

  1. #1
    Registered User
    Join Date
    03-15-2017
    Location
    Malaysia
    MS-Off Ver
    Microsoft 2010
    Posts
    24

    Macro Excel: Assigning Macro to User form

    I have a coding to calculate No. of x and y dies (it's actually column and row). How do I insert the coding into the UserForm to make it works? Then, after I key in the data for each x and y dies and press "Ok", I want the output to appear on my worksheet. What coding do I use for the "Ok" part? And for the "Cancel" part as well. I'm still new to VBA code.

    My code:
    Please Login or Register  to view this content.
    I have a UserForm as shown below.

    Capture.JPG
    https://stackoverflow.com/questions/...ro-to-userform
    Last edited by Ruffy; 03-23-2017 at 03:45 AM.

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

    Re: Macro Excel: Assigning Macro to User form

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Macro Excel: Assigning Macro to User form

    Try this one.
    Attached Files Attached Files
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Registered User
    Join Date
    03-15-2017
    Location
    Malaysia
    MS-Off Ver
    Microsoft 2010
    Posts
    24

    Re: Macro Excel: Assigning Macro to User form

    I am so sorry @Kyle123 Am I doing this thing correct now? I add the link to linkback.

  5. #5
    Registered User
    Join Date
    03-15-2017
    Location
    Malaysia
    MS-Off Ver
    Microsoft 2010
    Posts
    24

    Re: Macro Excel: Assigning Macro to User form

    Thank you so much @bakerman2! Your code works perfectly.

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Macro Excel: Assigning Macro to User form

    You're welcome and thanks for rep+.

+ 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] Assigning action to user form - macros
    By Toxicca in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-26-2016, 03:54 AM
  2. [SOLVED] Saving excel macro based on commandbutton1 click (user form)
    By S1n1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-17-2015, 03:15 PM
  3. assigning macro to a checkbox (form control)
    By Linus100 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-25-2014, 03:41 PM
  4. error with assigning macro to form buttons
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-16-2012, 08:13 PM
  5. strange error when assigning macro to a form object!
    By steve_doc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-03-2006, 03:40 PM
  6. [SOLVED] Assigning cell contents to a textbox in a User Form
    By Jack Gillis in forum Excel General
    Replies: 2
    Last Post: 06-08-2005, 11:05 AM
  7. How to: User Form to assign a user defined range to a macro variab
    By TrevTrav in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-22-2005, 04: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