Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default PLOTTING BASED ON MONTH/YEAR [DATE] MACROS

ei guys,

i have some problems regarding plotting[marking] dates.

i have this table where it shows 12 months based on the current date it
is run, so let's say it's october 7, 2005 today, my macros would plot
12 succeeding months starting october.

eg.

oct05 nov05 dec05 jan06 feb06 .... etc

now what i need to do is to mark the months based on to other dates the
user would fill up.

eg.

1st date: 11/15/2005
2nd date: 12/01/2006


now i have to put a mark the area where the input dates are in the
table i created:

eg.

oct05 nov05 dec05 jan06 feb06 .... etc
x x x x ....


but the my problem is i can't seem to get the year properly, i always
get an output like this one:


eg.


oct05 nov05 dec05 jan06 feb06 .... etc
x x

and that's it, i dont know what to do for it to mark until next year.

here's a part of my code:

Dim totalyr As Integer
Dim totalmo As Integer
Dim x As Integer



'Sheets("ATR").Select
Range("O1").Select
ActiveCell.Offset(1, 0).Select

indate = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
offdate = ActiveCell.Value

modatein = Month(indate)
yrdatein = Year(indate)

modateoff = Month(offdate)
yrdateoff = Year(offdate)

totalyr = yrdateoff - yrdatein
'get how many months
If totalyr = 1 Then
totalmo = DateDiff("m", indate, offdate)
End If
If totalyr = 0 Then
totalmo = modateoff - modatein + 1
End If

'getting start plot month
Range("Q1").Select
celldate = ActiveCell.Value
mocelldate = Month(celldate)
yrcelldate = Year(celldate)
'getting difference of start plot date from roll in date
datetotal = DateDiff("m", celldate, indate)
If datetotal <= 12 Then
ActiveCell.Offset(0, datetotal).Select
ActiveCell.Offset(1, 0).Select
steps = 12 - datetotal
Else
If datetotal 12 And datetotal < 0 Then
Range("Q3").Select
End If
End If
If datetotal 12 Then
ActiveCell.Offset(0, 0).Select
ActiveCell.Offset(1, 0).Select
steps = 12 - datetotal
End If

'checks if roll in date is before start plot date
If celldate indate Then
excessdate = mocelldate - modatein
End If

'goes to the cell where plot starts
If datetotal <= excessdate Then
For x = 1 To excessdate
ActiveCell.Offset(0, 1).Select
Next
End If

'get remaining months for plotting
remainingdate = datetotal - excessdate
If plottedmonths <= remainingdate Then
For x = 0 To remainingdate
ActiveCell.Value = "1"
ActiveCell.Offset(0, 1).Select
Next
End If


it's actually almost my whole, i hope someone can help.

thanks man

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
count month when date is in day/month/year format ccKennedy Excel Worksheet Functions 6 April 30th 09 03:32 AM
Year-to-date based on current month John in Toronto Excel Discussion (Misc queries) 2 May 9th 08 04:23 PM
Tell me which "season" (Month/Day through Month/Day) a date(Month/Day/Year) falls in (any year)??? misscrf Excel Discussion (Misc queries) 1 December 14th 07 02:59 PM
Get Data based on Month and Year karstens Excel Worksheet Functions 1 August 2nd 06 12:42 AM
Sort month/date/year data using month and date only SMW820 Excel Discussion (Misc queries) 6 June 22nd 06 05:14 PM


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