LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default countif from whole row as range

Hi,
I have a multiple worksheets in a workbook each refers to one week of
year. Each sheets there is a one week schedule of staff. I have a
combobox1,command button1and listbox1 in a userform.After you select
the name of staff from combobox1, once I click on commandbutton1 I
want to display the name of the sheet in the first column of list box
and for the second column I want total number of "S" shift of that
staff. I wrote the code as follows which I get the sheet names(it
means the staff rostered for that week) but could get the countif
value. Coz,countif function needs to look for whole row as a range. My
question how can a look for a range for each sheet if the range is
entire row,or in row 202 from column 1 to 15(thats my range).For a
referance i write my code below:
Sub TotalShift()
Dim cell As Range
Dim trddate As Variant
Dim xcell As Range
Dim trd As Variant
Dim Sht As Worksheet
trddate = ComboBox1.Text
For Each Sht In ThisWorkbook.Sheets
Set xcell = Sht.Range("A1:AQ1000")
For Each cell In xcell.Columns(1).Cells
If cell.Text = trddate Then
UserForm1.ListBox1.AddItem Sht.Name
UserForm1.ListBox1.List(UserForm1.ListBox1.ListCou nt - 1,
1) = _
Application.WorksheetFunction.CountIf(cell.Row, "S")
' !!!! here how to get the range for each sheet
End
If
' certain row
Next cell
Next Sht
End Sub

 
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
COUNTIF to compare one range versus another range Phil Excel Programming 3 May 30th 07 10:39 PM
Countif between a range? Keeprogoal Excel Discussion (Misc queries) 2 June 21st 06 11:52 PM
Countif between a range? Keeprogoal Excel Worksheet Functions 1 June 21st 06 11:14 PM
countif and sum if over a range. Michael Excel Discussion (Misc queries) 2 November 3rd 05 05:30 PM
COUNTIF or not to COUNTIF on a range in another sheet Ellie Excel Worksheet Functions 4 September 15th 05 10:06 PM


All times are GMT +1. The time now is 04:21 AM.

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

About Us

"It's about Microsoft Excel"