Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Countif Code

Hi everyone,

I am trying to promt the user with an input box "What column to
count", then use that column to count the number of "Y"s in the
column, and return the number in a message box. Here's what I have so
far:

Sub Count_Yes()

Dim Count_Col As Range

Set Count_Col = Application.InputBox(prompt:= _
"Select Any Cell in Column to Count", Type:=8)
If Count_Col Is Nothing Then
Exit Sub
End If

'Count Function
'Message Box

End Sub

Thanks for any help!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 621
Default Countif Code

MsgBox WorksheetFunction.CountIf(Count_Col.EntireColumn, "Y")


Gord Dibben MS Excel MVP

On Tue, 17 May 2011 16:32:50 -0700 (PDT), Steve
wrote:

Hi everyone,

I am trying to promt the user with an input box "What column to
count", then use that column to count the number of "Y"s in the
column, and return the number in a message box. Here's what I have so
far:

Sub Count_Yes()

Dim Count_Col As Range

Set Count_Col = Application.InputBox(prompt:= _
"Select Any Cell in Column to Count", Type:=8)
If Count_Col Is Nothing Then
Exit Sub
End If

'Count Function
'Message Box

End Sub

Thanks for any help!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default Countif Code

Sub Count_Yes()
Dim R As Integer
On Error Resume Next
With Application
R = .InputBox("Select Any Cell in Column to Count",
Type:=8).Column
If R < 0 Then MsgBox .WorksheetFunction.CountIf(Columns(R), "Y")
End With
End Sub


On May 18, 4:32*am, Steve wrote:
Hi everyone,

I am trying to promt the user with an input box "What column to
count", then use that column to count the number of "Y"s in the
column, and return the number in a message box. *Here's what I have so
far:

Sub Count_Yes()

Dim Count_Col As Range

* * Set Count_Col = Application.InputBox(prompt:= _
* * * * * * "Select Any Cell in Column to Count", Type:=8)
* * * * If Count_Col Is Nothing Then
* * * * * * Exit Sub
* * * * End If

* * * * 'Count Function
* * * * 'Message Box

End Sub

Thanks for any help!


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Countif Code

Thanks Gord!

On May 17, 7:51*pm, Gord Dibben wrote:
MsgBox WorksheetFunction.CountIf(Count_Col.EntireColumn, "Y")

Gord Dibben * * MS Excel MVP

On Tue, 17 May 2011 16:32:50 -0700 (PDT), Steve
wrote:



Hi everyone,


I am trying to promt the user with an input box "What column to
count", then use that column to count the number of "Y"s in the
column, and return the number in a message box. *Here's what I have so
far:


Sub Count_Yes()


Dim Count_Col As Range


* *Set Count_Col = Application.InputBox(prompt:= _
* * * * * *"Select Any Cell in Column to Count", Type:=8)
* * * *If Count_Col Is Nothing Then
* * * * * *Exit Sub
* * * *End If


* * * *'Count Function
* * * *'Message Box


End Sub


Thanks for any help!- Hide quoted text -


- Show quoted text -


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
using countif function in code Bradly Excel Programming 2 February 4th 10 10:05 PM
What's the vba code equivalent for Countif NDBC Excel Discussion (Misc queries) 3 July 4th 09 11:42 AM
Why does this COUNTIF code not work ChipButtyMan Excel Programming 5 October 20th 08 07:41 PM
COUNTIF TO BUILD SIMPLE CODE Eddy Stan Excel Worksheet Functions 6 August 26th 07 11:06 PM
doing COUNTIF() in code lothario[_74_] Excel Programming 2 January 26th 04 03:01 AM


All times are GMT +1. The time now is 12:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"