Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50068

Odd Type Mismatch with variables and the month function.

$
0
0
I get a type mismatch on the line where I set "second" = to the month of the next cell. This is particularly odd because the variable "First" is subject to the same method -- the only difference is that I'm using an offset inside the month function. I've checked the cells and they're all listed as "date" for their type -- not sure if that would be an issue but even if it would it shouldn't be.

Thoughts?

Thanks, very much.

Code:

sub monthlyData()
dim first as integer
dim second as integer

'end month is at the bottom therefore we delete a row if the row below it has the same month

worksheets("monthlydata").activate
range("A2").select

Do
first = month(activecell)
second = month(activecell.offset(1,0))

if first = second then
activecell.row.delete
Else
End If

activecell.offset(1,0).select

Loop Until IsEmpty(activecell.offset(1,0))


Viewing all articles
Browse latest Browse all 50068

Trending Articles