Well, my test code was just a simple If ActiveCell.Value = True, and if so,
msgbox Something In There, and if not msgbox Nothing There. When I put a
number in the cell, I got the first msgbox, and when I deleted it, got the
latter. Having never used that method before, deduced that it would recognize
any cell that had content.
However, when I then applied it to a true range of data, it considered cells
with a zero in it to be empty and wrote over them rather than skipping past
to the next truly empty cell.
Thanks for the reply by the way. It helps to know that I wasn't using that
piece of code correctly.
"Dave Peterson" wrote:
> VBA sees True as -1.
> and every other value as false.
>
> I'm not sure what was in your cell to get it to work, though.
>
>
>
> danhattan wrote:
> >
> > That worked very well, so I thank you for that, but wonder if you might be
> > able to clear up another bit of confusion.
> >
> > After I made the post, I wondered if activecell.value = true might be a good
> > test. Whipped it up in a test spreadsheet and it worked. But when I put it
> > into the real spreadsheet this morning, it didn't recognize 0's as cell
> > content.
> >
> > Is there a simple explanation for why that would be? If you have the time to
> > answer, again, much appreciated.
> >
> > "Dave Peterson" wrote:
> >
> > > For one cell:
> > > if isempty(yourrangehere.value) then
> > >
> > > If it's multiple cells:
> > > if application.counta(yourrangehere) = 0 then
> > >
> > > danhattan wrote:
> > > >
> > > > I need to know if a cell is empty so my code can paste into it if so. If I
> > > > were just entering a formula into a worksheet I'd just use COUNT or COUNTA.
> > > > But I'm not sure what the equivalent check in VBA is. Unfortunately, my data
> > > > will at times include zeros so checking for >0 isn't working either.
> > > >
> > > > If anyone can help me, it's very much appreciated.
> > > >
> > > > Dan
> > >
> > > --
> > >
> > > Dave Peterson
> > >
>
> --
>
> Dave Peterson
>
|