Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SELECT CASE - Which Row am I on?


Select Case is running in Range W8:W149 and is working.

How do I determine what row I am on and add the number in Coulmn D to
variable?

Column D contains the total sales (if any) for the day of the week.
Some days have no sales other days have multiple sales.

I am calculating the number of sales with this Select Case.

I would like to know the total of all the sales by weekday.


------------------------------
For Each rIncDay In Range("W8:W149") 'Need Last Row loop
Select Case (rIncDay)
'-------------------------
'Days of the week
Case "SUNDAY"
iSun = iSun + 1
Case "MONDAY"
iMon = iMon + 1
Case "TUESDAY"
iTue = iTue + 1
Case "WEDNESDAY"
iWed = iWed + 1
Case "THURSDAY"
iThu = iThu + 1
Case "FRIDAY"
iFri = iFri + 1
Case "SATURDAY"
iSat = iSat + 1
'-------------------------
Case Else
iOther = iOther + 1 'Error trap not in SELECT CASE
'-------------------------
End Select
Next rIncDay
----------------------------

Muchos Gracias, Mi Amigo!
Craig

--
Craig
-----------------------------------------------------------------------
Craigm's Profile: http://www.excelforum.com/member.php...fo&userid=2438
View this thread: http://www.excelforum.com/showthread.php?threadid=38260

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SELECT CASE - Which Row am I on?


rIncDay.row ' will return the row number



dim sum_sales as variant
sum_sales=0
For Each rIncDay In Range("W8:W149") 'Need Last Row loop
sum_sales=sum_sales+range("d" & rIncDay.row).value 'adding the
column
Select Case (rIncDay)
'-------------------------
'Days of the week
Case "SUNDAY"
iSun = iSun + 1
Case "MONDAY"
iMon = iMon + 1
Case "TUESDAY"
iTue = iTue + 1
Case "WEDNESDAY"
iWed = iWed + 1
Case "THURSDAY"
iThu = iThu + 1
Case "FRIDAY"
iFri = iFri + 1
Case "SATURDAY"
iSat = iSat + 1
'-------------------------
Case Else
iOther = iOther + 1 'Error trap not in SELECT CASE
'-------------------------
End Select
Next rIncDay
msgbox sum_sale

--
anilsolipura
-----------------------------------------------------------------------
anilsolipuram's Profile: http://www.excelforum.com/member.php...fo&userid=1627
View this thread: http://www.excelforum.com/showthread.php?threadid=38260

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
select case in vba Hein Excel Discussion (Misc queries) 5 November 25th 09 07:28 AM
Case Select NoodNutt Excel Worksheet Functions 7 September 21st 08 02:10 AM
Case without Select Case error problem Ayo Excel Discussion (Misc queries) 2 May 16th 08 03:48 PM
Select Case Jeff Excel Discussion (Misc queries) 1 February 27th 06 02:56 PM
Case Select Bill Excel Programming 10 January 8th 05 05:02 PM


All times are GMT +1. The time now is 10:01 PM.

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"