Closed Thread
Results 1 to 7 of 7

combine codes

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Bergen, Norway
    MS-Off Ver
    MS 365 Subscription
    Posts
    369

    combine codes

    Hi,

    I have two codes that workes seperatly, but when I try to combine these two itīs not working.

    First code located in the Sheet10
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Range("H15").Value < Range("E15").Value Then
         MsgBox "Eulers gjelder ikke", vbCritical
         
    End If
    
    End Sub
    Second code located in sheet called Kalkulasjon
    Private Sub CommandButton1_Click()
        OptionButton1.Value = False
        OptionButton2.Value = False
        OptionButton3.Value = False
        OptionButton4.Value = False
        OptionButton5.Value = False
    
        Range("I3:I9,L3:L9,P13:AE13,P16").ClearContents
    End Sub
    Any help is much appreciated

    Regards
    Oeysbrei

  2. #2
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: combine codes

    hi...
    Try.

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Range("H15").Value < Range("E15").Value Then
         MsgBox "Eulers gjelder ikke", vbCritical
         
    End If
    Call Teste
    End Sub

     Sub Teste()
        OptionButton1.Value = False
        OptionButton2.Value = False
        OptionButton3.Value = False
        OptionButton4.Value = False
        OptionButton5.Value = False
    
        Range("I3:I9,L3:L9,P13:AE13,P16").ClearContents
    End Sub
    "No xadrez nem sempre a menor dist?ncia entre dois pontos ? uma linha reta" G. Kasparov.

    If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select b from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

  3. #3
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Bergen, Norway
    MS-Off Ver
    MS 365 Subscription
    Posts
    369

    Re: combine codes

    marreco,

    Thanks for the reply.
    Iīve tryed it but it dident work.

    Oeysbrei

  4. #4
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Bergen, Norway
    MS-Off Ver
    MS 365 Subscription
    Posts
    369

    Re: combine codes

    Hi,

    Anyone out there to help me solv this challenge?

    Regards
    Oeysbrei

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: combine codes

    probably help if you said more than it isn't working.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  6. #6
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Bergen, Norway
    MS-Off Ver
    MS 365 Subscription
    Posts
    369

    Re: combine codes

    Hi JosephP,

    In my first post of this thread I posted the two codes and where they are located.
    When I try to combine these two I get error, and the first line where it says OptionButton1.Value = False turns yellow.

    I have tryed different, but iīm just in the startpitch regarding macrocoding.
    I have attached a printscreen of my code with the errormessage for you to have a look at.

    Hope you can help me solv this

    Regards
    Oeysbrei
    Attached Files Attached Files

  7. #7
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: combine codes

    Welcome to the Forum, unfortunately:

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Thread Closed.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

Closed Thread

Thread Information

Users Browsing this Thread

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

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