+ Reply to Thread
Results 1 to 3 of 3

Thread: macros programming

  1. #1
    Registered User
    Join Date
    06-03-2010
    Location
    Sinaloa, Mexico
    MS-Off Ver
    Excel 2003
    Posts
    20

    Red face macros programming

    Hi, again;

    Now i have 2 questions.

    1.- Its posible to jump from the user form to one sheet. i mean, to programm one command button to, for example go and check the results of your modifications made by your userform?

    2.- how can i pop up a comment if a value A > Value B,. I mean, im going to put some values in the textbox, this values will modify some cells in the same sheet, but if the sum of these modified cells are > than the value of one cell in the same sheet, i want to show a commet like " watcht out, you are excedding your needs".

    hope you can help me

    thank you people

  2. #2
    Forum Guru Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007
    Posts
    3,523

    Re: macros programming

    I would check to see that the condition is met BEFORE writing the userform values to the worksheet and prompt the operator if the sum of values exceeds the limit.

    Here is the basic approach, code assigned to the command button:
     Option Explicit
    
    Private Sub CommandButton1_Click()
    
        Dim n1 As Long, n2 As Long
        
        n1 = Me.TextBox1.Value
        n2 = Me.TextBox2.Value
        
        With Me
            If n1 + n2 > Sheet1.Range("A1").Value Then
                MsgBox "exceeds needs"
            End If
        End With
    
    End Sub
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,639

    Re: macros programming

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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.2.0