View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Tokyo or bust[_2_] Tokyo or bust[_2_] is offline
external usenet poster
 
Posts: 4
Default Simple question - help please and thank you.

Not a whole lot -
I used it a bit 4-5 years ago, but been a while. I know the basics, but not
a whole lot more.

"Joel" wrote:

The format for functions on a excel worksheett verses the visual basic
language are different. To reference a cell from VB you would neet to do
something like this


if month(cell("A3")) < month(cell("A3").Offset(rowOffset:=0,
columnOffset:=-1)) then

I don't know how much experiece you have with the VB language. O

"Tokyo or bust" wrote:

Hi Joel - thanks for the message -

tried this in VBA:

If Month(bin, 1) = Month(bin - 1, 1) Then


and I got a compile error "Wrong number of arguments or invalid property
assignments"



"Joel" wrote:

A simple way is to compare the months with a if statement.

If(month(b1)<month(c1),,) assuming the date is in row 1.

"Tokyo or bust" wrote:

Hey,

I am calculating simple monthly returns on a series of daily asset prices
for a number of years worth of data. The problem is I am not sure how to
indentify the end of a month, and the start of the next in a column of
05/01/2006 format sequential dates. I could just add another column and use
the "month" function in excel (what I have done thus far), but I have to do
the whole operation in VBA. What I have now is:

If ActiveSheet.Cells(dayofmonth, 1) = ActiveSheet.Cells(dayofmonth - 1, 1)
Then day +1 and continue till they are different etc......

The first column is a single number derived from a = month(date column)
formula

This unfortunately will not cut it.

I want to be able to do the same operation, but not have to use the month
function in excel - just reference the date column (04/09/2006 format). I am
pretty sure I need to use a ActiveCell.Formula and a month function, but am
unsure as to how to write the formula - any help would be tremendously
appreciated.

Regardless of how easy it is, I have sweat over this for some time.......

Thanks - cheers.