+ Reply to Thread
Results 1 to 9 of 9

Countifs vba is not working

  1. #1
    Registered User
    Join Date
    08-08-2007
    Posts
    23

    Countifs vba is not working

    Hi I need your help

    I am trying to use countifs in Vba and it is not working. I have 2 worksheets - Sheet 1 have the date, Sheet two have the Input points and where I need to put the result.
    When I put the code like this

    Please Login or Register  to view this content.
    When I put just the numbers it work

    Please Login or Register  to view this content.

    However I want it read the input cause it might change. Also I need a pop error message if the user type by mistake the beginning mile point large than the end mile point .

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by lolla70; 01-15-2020 at 10:15 PM.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Countifs vba is not working

    This

    Please Login or Register  to view this content.
    Should be

    Please Login or Register  to view this content.
    Is this homework as your file indicates? Other than making the change indicated above, what have you as far as the message?
    Last edited by jeffreybrown; 01-15-2020 at 08:10 PM.
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    08-08-2007
    Posts
    23

    Re: Countifs vba is not working

    I changed it, it didn't work

    This for the nessage

    'To show a message in a popup dialog, use the following command:
    'MsgBox("Incorrect input. The beginning mile point cannot be greater than ending mile point.")
    If Begining_Mile_Point > Ending_Mile_Point Then
    MsgBox ("Incorrect input. The beginning mile point cannot be greater than ending mile point.")
    End If

  4. #4
    Registered User
    Join Date
    08-08-2007
    Posts
    23

    Re: Countifs vba is not working

    Please Login or Register  to view this content.
    Last edited by Leith Ross; 01-15-2020 at 09:21 PM. Reason: Added Code Tags

  5. #5
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Countifs vba is not working

    [.... deleted by me ....]
    Last edited by joeu2004; 01-15-2020 at 09:31 PM.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Countifs vba is not working

    Hello lolla70,

    Here is the amended code for the CountIfs. The problem was with your double quotes.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  7. #7
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Countifs vba is not working

    @Leith.... I deleted my similar response when I realized that this is a "test" or "homework", and it is unclear whether the VBA use of CountIfs is part of what is being tested or assigned (which I would not do), or it is just part of lolla70's implementation of a larger problem (in which case I might help with the syntax).

  8. #8
    Registered User
    Join Date
    08-08-2007
    Posts
    23

    Re: Countifs vba is not working

    Thank you it working now. This is for work related.

  9. #9
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Countifs vba is not working

    Hello lolla70,

    You're welcome.

+ 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] COUNTIFS not working for 2 values, but PIVOT is working fine
    By chaiyya345 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-04-2019, 05:44 AM
  2. countifs not working
    By superchew in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-02-2016, 04:48 PM
  3. [SOLVED] countifs not working
    By stephme55 in forum Excel General
    Replies: 2
    Last Post: 05-17-2016, 01:02 PM
  4. Countifs not working
    By cardonas in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-30-2016, 01:32 PM
  5. (VBA) COUNTIFS using MID not working
    By newbi004 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-17-2015, 08:11 AM
  6. [SOLVED] countifs working on extended ranges and different sheets not working
    By etaf in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-18-2013, 02:23 PM
  7. COUNTIFS not working
    By nosenga in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-13-2011, 04:38 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