Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default select case help please

Could someone please provide me the basics on the "select case"
statement? I am working on a Workbook_change procedure that performs
some calculations based on text that is entered into a target cell.

If the person types "2002Q1" the calculations performed are different
than if the person types in "2002Q4" or "2004Q3" etc. I only have one
test case written now for "2002Q1" but the calculations are performing
no matter what I type. Here's how I have started it, I intend to
create a case for each quarter from 2002 - 2008. Please advise! I have
a feeling I really don't understand the basic syntax of the Select
Case statement.

Select Case Quarter
Case ActiveCell.Offset(0, -4).Value = "2002Q1"

Many thanks,
Christine Flott
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default select case help please


Select Case Sheets("Sheet1").Range("A1")

Case "2002Q1"
'Your code here
Case "2002Q4"
'Your code here
Case "2004Q3", "2002Q1" ' if both having same
calculation
' your code here
End Select


Abdul Salam

-----Original Message-----
Could someone please provide me the basics on

the "select case"
statement? I am working on a Workbook_change procedure

that performs
some calculations based on text that is entered into a

target cell.

If the person types "2002Q1" the calculations performed

are different
than if the person types in "2002Q4" or "2004Q3" etc. I

only have one
test case written now for "2002Q1" but the calculations

are performing
no matter what I type. Here's how I have started it, I

intend to
create a case for each quarter from 2002 - 2008. Please

advise! I have
a feeling I really don't understand the basic syntax of

the Select
Case statement.

Select Case Quarter
Case ActiveCell.Offset(0, -4).Value

= "2002Q1"

Many thanks,
Christine Flott
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default select case help please

Thanks guys. I don't know what my problem was but it got it a few
minutes later. It looks like this:

Select Case ActiveCell.Offset(0, -4).Value
Case "2002Q1"
code
code
Case "2002Q2"
code
code...
Case Else
Msgbox "Please enter date in the correct format"

etc.

Thanks again for your assistance I think I needed to give up for a
while and go back to it later.

Christine
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default select case help please

Christine,

Don't feel bad - it took me forever to understand how to put together one of
these. And I am just beginning to get the hang of it.

steve

"Christine Flott" wrote in message
om...
Thanks guys. I don't know what my problem was but it got it a few
minutes later. It looks like this:

Select Case ActiveCell.Offset(0, -4).Value
Case "2002Q1"
code
code
Case "2002Q2"
code
code...
Case Else
Msgbox "Please enter date in the correct format"

etc.

Thanks again for your assistance I think I needed to give up for a
while and go back to it later.

Christine





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 Hein Excel Discussion (Misc queries) 5 November 24th 09 01:19 PM
Select Case jlclyde Excel Discussion (Misc queries) 5 January 6th 09 09:05 PM
Select case Hein Excel Discussion (Misc queries) 2 October 22nd 08 07:06 AM
Case without Select Case error problem Ayo Excel Discussion (Misc queries) 2 May 16th 08 03:48 PM
Need help on Select Case Susan Hayes Excel Worksheet Functions 1 November 3rd 04 10:25 PM


All times are GMT +1. The time now is 05:58 PM.

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"