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: 3
Default VBA problem

Greetings,

I have a spreadsheet in a format such as below
A B C D
1 1-Jan-03 to 31-Jan-03
2 Peak X
3 Off Peak Y
4 1-Feb-03 to 28-Feb-03
5 Peak X
6 Off Peak Y
7 Demand
8 1-Mar-03 to 31-Mar-03
9 Peak
10 Off Peak
11 Demand

What I want to do is work out if:

For each cell in column A If the month is equal to January
or February then
if cell within that month in column C equals "peak" then
cell in column D = X
else if cell within the month in column C equals off peak
then cell in column D = Y

1/ How I can instruct it to work out for each cell in
column A if it the month equals Jan or Feb?

2/ Secondly how can I write some code for it to recognoise
that "Peak" is part of January or under February...ie how
does it knows that Peak is part of January in C2 and part
of February in C6? In a nutshell I need some code for
it to recognise that between C2 and C3 it is January and
between C5-C7 it is February & C9-C11 is March. The
problem is in the next spreadsheet January could be C5-C15
or February could be C2-C4 so I cant specify exactly which
cells equate to which month as it will vary from one
spreadsheet to the next and is not set in stone.

Thanks in advance

Simon

 
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
Colon at the end of excel file name(ex: problem.xls:1, problem.xls financeguy New Users to Excel 2 January 15th 10 01:15 AM
big problem Wu Excel Discussion (Misc queries) 3 February 15th 09 07:48 AM
Started out as an Access problem. Now an Excel problem RobertM Excel Discussion (Misc queries) 2 April 26th 06 07:30 PM
Tab key problem Mary C Excel Discussion (Misc queries) 1 October 4th 05 10:48 PM
problem with a conditional max problem Brian Cornejo Excel Discussion (Misc queries) 1 February 18th 05 06:25 PM


All times are GMT +1. The time now is 07:15 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"