View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default select case help please

Christine,

Try something like

Select Case Target.Value
Case "2002Q1"
' code
Case "2002Q2"
' code
Case "2002Q3"
' code
....
Case Else
' code
End Select


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Christine Flott" wrote in message
om...
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