Calculating number of days in month

  • Thread starter Thread starter Jeff Armstrong
  • Start date Start date
J

Jeff Armstrong

I have statistical data about various network components.
The statistics are captured daily. The data comes to me
in the form of a space delimited text file. When I import
into excel the each row represents a days worth of data.
Depending on when the network component was placed into
service will determine the starting date. This means the
date will fluctuate for every component.

What I am trying to do is average the data by month. I
have 452 components that I am trying to do this for. As
such I will have 452 dates that the components went into
service. I need the macro to be able to determine what
day of the month the component went into service and move
down the list until it gets to a new month. Then go back
and insert a row to average all the previous months data.
Then continue on until it reaches the current day. I have
the code to insert the row and average the data. What I
need is the logic for the dates. Does anyone have any
ideas how I can go about solving this problem?

Jeff
 
Try this.....

Dim Mth As Integer
Mth = Month(Range("A1"))

or

Mth = Month(Cells(1,1))

Set the range required for the data cell or the index values of row,column
in the 2nd example

Cheers
Nigel
 
Back
Top