+ Reply to Thread
Results 1 to 26 of 26

Msgbox not comming up

  1. #1
    Forum Contributor
    Join Date
    08-31-2007
    MS-Off Ver
    2010
    Posts
    130

    Msgbox not comming up

    I have added the following code.

    Please Login or Register  to view this content.
    But it is not working. I am not getting a Msgbox or is it selecting F8.
    My guess is I have a typo as I have used code very much the same before and it worked well.
    Any help will be much appreciated.

  2. #2
    Valued Forum Contributor Gatti's Avatar
    Join Date
    06-08-2015
    Location
    Brasil, São Paulo, Ribeirão Preto
    MS-Off Ver
    365
    Posts
    346

    Re: Msgbox not comming up

    Did you DEBUG the code to check why it is resulting FALSE in the If statement?

    This Sheets("Sheet1").Select opens other sheet then the Worksheet_Change2?

    Cause you are changing the sheet after a worksheet change routine

    It doesn't make much sense...

    Post the workbook here, if possible

  3. #3
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Msgbox not comming up

    It should be :

    Private Sub Worksheet_Change(ByVal Target As Range)

    and not :

    Private Sub Worksheet_Change2(ByVal Target As Range)

  4. #4
    Forum Contributor
    Join Date
    08-31-2007
    MS-Off Ver
    2010
    Posts
    130

    Re: Msgbox not comming up

    I have removed the 2 from Private Sub Worksheet_Change2(ByVal Target As Range)

    And I did try to DEBUG the code it is not showing any errors but still the code is not working either.

  5. #5
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Msgbox not comming up

    Maybe you accidentaly disable event, put the code below to normal module and run it, and see if this can fix it :

    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor Gatti's Avatar
    Join Date
    06-08-2015
    Location
    Brasil, São Paulo, Ribeirão Preto
    MS-Off Ver
    365
    Posts
    346

    Re: Msgbox not comming up

    Wouldsman... the problem probably isn't an error... the IF statment probably is resulting FALSE, then it doesn't run into msgbox code

  7. #7
    Forum Contributor
    Join Date
    08-31-2007
    MS-Off Ver
    2010
    Posts
    130

    Re: Msgbox not comming up

    Changing that gives me a Type mismatch

  8. #8
    Valued Forum Contributor Gatti's Avatar
    Join Date
    06-08-2015
    Location
    Brasil, São Paulo, Ribeirão Preto
    MS-Off Ver
    365
    Posts
    346

    Re: Msgbox not comming up

    Could you please post the workbook or a sample?

  9. #9
    Registered User
    Join Date
    01-22-2016
    Location
    Albany, NY
    MS-Off Ver
    2010
    Posts
    31

    Re: Msgbox not comming up

    Do you know whether the line of code for MsgBox is even getting executed?

    If not, maybe try removing one of the conditions to see if it makes any difference. One of the conditions could be generating unexpected results etc.

    i.e.

    If Target.Address = "$F$7" Then
    MsgBox "Numbers may not exceed 3"
    Application.Goto Reference:=Range("F8"), Scroll:=False
    End If

  10. #10
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Msgbox not comming up

    Quote Originally Posted by Wouldsman View Post
    Changing that gives me a Type mismatch
    That means, Excel starting to catch the event now, but somehow the datatype is mismatch, as the error says (such as enter formula =1/0 on cell F7).
    As others say, please upload the sample file, so we can examine it.

  11. #11
    Forum Contributor
    Join Date
    08-31-2007
    MS-Off Ver
    2010
    Posts
    130

    Re: Msgbox not comming up

    I make up a sample file tomorrow morning and post it.
    Thanks for all the help thus far.

  12. #12
    Forum Contributor
    Join Date
    08-31-2007
    MS-Off Ver
    2010
    Posts
    130

    Re: Msgbox not comming up

    Here is a sample of the Excel file.
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    08-31-2007
    MS-Off Ver
    2010
    Posts
    130

    Re: Msgbox not comming up

    Sorry
    The code in question is Sheet1(Sheet1) [Change under code in question]

    Looks like I deleted contents of cell F7 should read (( F8-F6 ))
    Last edited by Wouldsman; 02-05-2016 at 08:10 AM.

  14. #14
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Msgbox not comming up

    You put the issue code (green) after "Exit Sub" (red) statement, of course, they will never be executed.

    Please Login or Register  to view this content.
    Your code should be something like this :

    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    08-31-2007
    MS-Off Ver
    2010
    Posts
    130

    Re: Msgbox not comming up

    No nothing.
    Like there is no code even there?

  16. #16
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Msgbox not comming up

    Here, I have upload the workbook to test.

    First, run (Press Alt F8) Sub EventEnabler() to make sure the event trapping is enabled.

    Then, the worksheet_change event should worked.
    Attached Files Attached Files

  17. #17
    Forum Contributor
    Join Date
    08-31-2007
    MS-Off Ver
    2010
    Posts
    130

    Re: Msgbox not comming up

    Any other thoughts?

  18. #18
    Forum Contributor
    Join Date
    08-31-2007
    MS-Off Ver
    2010
    Posts
    130

    Re: Msgbox not comming up

    Karedog,

    Any other thoughts?

    I thought it may have worked one time but it was a flash and gone.
    Now nothing.
    Last edited by Wouldsman; 02-05-2016 at 11:18 AM.

  19. #19
    Forum Contributor
    Join Date
    08-31-2007
    MS-Off Ver
    2010
    Posts
    130

    Re: Msgbox not comming up

    Karedog,

    I started a new workbook and entered the following into "WorkSheet"
    Please Login or Register  to view this content.
    And if I enter a number larger than 3 (into F7)and press enter nothing
    But if I now reselect cell F7 it works.
    But if have to return manually to F7 every time to make it work.

  20. #20
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Msgbox not comming up

    Have you tried to open and run my attachment on post #16, and run the Sub EventEnabler ?
    What is the result ? Or do you just copy and paste the code to your own file ?

    As your code on post #19, you put the code in Worksheet_SelectionChange() event, that's why it is triggered only if you select the cell (F7).
    You should put it inside Worksheet_Change() event.

  21. #21
    Forum Contributor
    Join Date
    08-31-2007
    MS-Off Ver
    2010
    Posts
    130

    Re: Msgbox not comming up

    I have tried that one (post #16) it flashed a message "to quickly to really see" and will not work a second time.

  22. #22
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Msgbox not comming up

    Now, it's strange. By examing all the code in your file, the only possible "flash message" is a MsgBox window, but the MsgBox window cannot close itself by code.
    I suspect there is a software in your computer that do this, or an Excel addin, or a macro in your Personal.xls file. Could you try to open dan run myfile (in post #16) in other computer(s) ? It is run very well on my PC.

  23. #23
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,347

    Re: Msgbox not comming up

    Sorry duplicate post
    Last edited by scottiex; 02-05-2016 at 03:38 PM. Reason: duplicate post

  24. #24
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,347

    Re: Msgbox not comming up

    Maybe you just want worksheet_change and to pull the msg even when you the target is another cell. (so you get the message even when you are clicking off the cell).

    Please Login or Register  to view this content.
    Last edited by scottiex; 02-05-2016 at 04:08 PM.

  25. #25
    Forum Contributor
    Join Date
    08-31-2007
    MS-Off Ver
    2010
    Posts
    130

    Re: Msgbox not comming up

    Thanks to both of you it is working now.

  26. #26
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,347

    Re: Msgbox not comming up

    Good to hear.
    Does that mean you used my code? Or did you find another solution like maybe an underlying issue as per karedog's suggestion?

+ 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. What IF ,and, list comming up with to many levels nesting
    By gazza uk in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-25-2016, 10:52 PM
  2. When i delete a entry then comming up a debug
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-26-2014, 08:19 PM
  3. late comming and ealy going calculation
    By anjana arora in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-07-2014, 01:43 PM
  4. [SOLVED] whole printing image is not comming, and it tiled
    By gsrikanth in forum Word Formatting & General
    Replies: 3
    Last Post: 04-09-2013, 02:13 AM
  5. Document repair keeps comming up
    By jjjgroot in forum Excel General
    Replies: 6
    Last Post: 11-29-2012, 06:06 AM
  6. How can i stop comming spam mails ??
    By champs in forum Outlook Formatting & Functions
    Replies: 2
    Last Post: 03-04-2009, 09:44 AM
  7. Pivot Tables comming from two data sources
    By rbw in forum Excel General
    Replies: 2
    Last Post: 08-31-2007, 05:32 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