+ Reply to Thread
Results 1 to 10 of 10

COUNTA msgbox

  1. #1
    Forum Contributor
    Join Date
    09-08-2005
    Location
    UK
    MS-Off Ver
    2010
    Posts
    107

    COUNTA msgbox

    I'm not sure if this is possible but I have been trying to create a macro that would do a COUNTA function on a selected range and display the result in a message box

    i.e.

    Dim Rangea As Range
    Dim Resulta As Variant

    Rangea = selelected.Range
    Resulta = Application.WorksheetFunctions.counta.Rangea
    MsgBox Resulta

    It doesn't come close to working so can anyone suggest a way of accomplishing this?

    Cheers

  2. #2
    R.VENKATARAMAN
    Guest

    Re: COUNTA msgbox

    try this

    worksheetfunction.CountA(columns("B:B"))

    fill some entries in columnB
    and type this in immediate window
    ?worksheetfunction.CountA(columns("B:B"))
    what do you get


    "Daminc" <Daminc.1zrpzm_1134123902.1069@excelforum-nospam.com> wrote in
    message news:Daminc.1zrpzm_1134123902.1069@excelforum-nospam.com...
    >
    > I'm not sure if this is possible but I have been trying to create a
    > macro that would do a COUNTA function on a selected range and display
    > the result in a message box
    >
    > i.e.
    >
    > Dim Rangea As Range
    > Dim Resulta As Variant
    >
    > Rangea = selelected.Range
    > Resulta = Application.WorksheetFunctions.counta.Rangea
    > MsgBox Resulta
    >
    > It doesn't come close to working so can anyone suggest a way of
    > accomplishing this?
    >
    > Cheers
    >
    >
    > --
    > Daminc
    > ------------------------------------------------------------------------
    > Daminc's Profile:

    http://www.excelforum.com/member.php...o&userid=27074
    > View this thread: http://www.excelforum.com/showthread...hreadid=492124
    >




  3. #3
    chijanzen
    Guest

    RE: COUNTA msgbox


    MsgBox WorksheetFunction.CountA(Selection)

    --
    天行健,君*以自強不息
    地勢坤,君*以厚德載物

    http://www.vba.com.tw/plog/


    "Daminc" wrote:

    >
    > I'm not sure if this is possible but I have been trying to create a
    > macro that would do a COUNTA function on a selected range and display
    > the result in a message box
    >
    > i.e.
    >
    > Dim Rangea As Range
    > Dim Resulta As Variant
    >
    > Rangea = selelected.Range
    > Resulta = Application.WorksheetFunctions.counta.Rangea
    > MsgBox Resulta
    >
    > It doesn't come close to working so can anyone suggest a way of
    > accomplishing this?
    >
    > Cheers
    >
    >
    > --
    > Daminc
    > ------------------------------------------------------------------------
    > Daminc's Profile: http://www.excelforum.com/member.php...o&userid=27074
    > View this thread: http://www.excelforum.com/showthread...hreadid=492124
    >
    >


  4. #4
    Jan Karel Pieterse
    Guest

    Re: COUNTA msgbox

    Hi Daminc,

    > Dim Rangea As Range
    > Dim Resulta As Variant
    >
    > Rangea = selelected.Range
    > Resulta = Application.WorksheetFunctions.counta.Rangea
    > MsgBox Resulta
    >


    Close:

    Dim Rangea As Range
    Dim Resulta As Variant

    Set Rangea = selelected.Range
    Resulta = Application.WorksheetFunctions.counta(Rangea)
    MsgBox Resulta

    Regards,

    Jan Karel Pieterse
    Excel MVP
    http://www.jkp-ads.com


  5. #5
    Gordon Rainsford
    Guest

    Re: COUNTA msgbox

    Dim result As Integer
    result = WorksheetFunction.Counta(Selection)
    MsgBox result


    --
    Gordon Rainsford

    London UK


    Daminc <Daminc.1zrpzm_1134123902.1069@excelforum-nospam.com> wrote:

    > I'm not sure if this is possible but I have been trying to create amacro

    that would do a COUNTA function on a selected range and displaythe
    result in a message box
    >
    > i.e.
    >
    > Dim Rangea As Range
    > Dim Resulta As Variant
    >
    > Rangea = selelected.Range
    > Resulta = Application.WorksheetFunctions.counta.Rangea
    > MsgBox Resulta
    >
    > It doesn't come close to working so can anyone suggest a way
    > ofaccomplishing this?
    >


  6. #6
    Norman Jones
    Guest

    Re: COUNTA msgbox

    Hi Daminc,

    You have several code suggestions. However, this information is available
    directly in the report on the right-hand side of the status bar,


    ---
    Regards,
    Norman



    "Daminc" <Daminc.1zrpzm_1134123902.1069@excelforum-nospam.com> wrote in
    message news:Daminc.1zrpzm_1134123902.1069@excelforum-nospam.com...
    >
    > I'm not sure if this is possible but I have been trying to create a
    > macro that would do a COUNTA function on a selected range and display
    > the result in a message box
    >
    > i.e.
    >
    > Dim Rangea As Range
    > Dim Resulta As Variant
    >
    > Rangea = selelected.Range
    > Resulta = Application.WorksheetFunctions.counta.Rangea
    > MsgBox Resulta
    >
    > It doesn't come close to working so can anyone suggest a way of
    > accomplishing this?
    >
    > Cheers
    >
    >
    > --
    > Daminc
    > ------------------------------------------------------------------------
    > Daminc's Profile:
    > http://www.excelforum.com/member.php...o&userid=27074
    > View this thread: http://www.excelforum.com/showthread...hreadid=492124
    >




  7. #7
    Forum Contributor
    Join Date
    09-08-2005
    Location
    UK
    MS-Off Ver
    2010
    Posts
    107
    Thanks for your replies.

    There are several suggestions that work great here for what I wanted and a lot more food for thought in the bargain

    I'm not sure where this info is though:
    "However, this information is available directly in the report on the right-hand side of the status bar,"

  8. #8
    Jan Karel Pieterse
    Guest

    Re: COUNTA msgbox

    Hi Daminc,

    > I'm not sure where this info is though:
    > -"However, this information is available directly in the report on the
    > right-hand side of the status bar,"-


    If you select some cells, the staus bar can show a number of statistics
    (on the right hand side): SUM, COUNT, AVERAGE, MIN, MAX. Rightclick the
    status bar to activate this or change the function used.

    Regards,

    Jan Karel Pieterse
    Excel MVP
    http://www.jkp-ads.com


  9. #9
    Norman Jones
    Guest

    Re: COUNTA msgbox

    Hi Daminc,

    Just to add to Jan Karels's response, if you do not see the Status Bar then:

    Tools Options | View | Check 'Status Bar'

    ---
    Regards,
    Norman



    "Daminc" <Daminc.1zrtoz_1134128702.8397@excelforum-nospam.com> wrote in
    message news:Daminc.1zrtoz_1134128702.8397@excelforum-nospam.com...
    >
    > Thanks for your replies.
    >
    > There are several suggestions that work great here for what I wanted
    > and a lot more food for thought in the bargain
    >
    > I'm not sure where this info is though:
    > -"However, this information is available directly in the report on the
    > right-hand side of the status bar,"-
    >
    >
    > --
    > Daminc
    > ------------------------------------------------------------------------
    > Daminc's Profile:
    > http://www.excelforum.com/member.php...o&userid=27074
    > View this thread: http://www.excelforum.com/showthread...hreadid=492124
    >




  10. #10
    Forum Contributor
    Join Date
    09-08-2005
    Location
    UK
    MS-Off Ver
    2010
    Posts
    107
    Found it

    Cheers guys

+ Reply to 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