macro not working

1

1234

I have this simple macro:

Range("D3").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.Offset(-1, 0).Select = d
rowC4= d
TextBox112.Value = ActiveCell.Offset(rowC4, 0)
TextBox112.Value = (TextBox112 + 1)

It selects cell D3 and then it goes down til it finds the first
number. It musn´t take zero and blank cells. Once it finds the first
number I want, it stops and shows the the cell value. The macro I have
does this OK, but when it finds a zero, it stops when it should jump
it and the same with blank cells. What am I doing wrong?

Thanks
 
D

Dave Peterson

Assuming that there is data in D3 and D4, then using .end(xldown) will find the
last used cell in that grouping. It doesn't avoid 0's. It does stop at the
first empty cell (empty means no formula and no value).

This line:
ActiveCell.Offset(-1, 0).Select = d
doesn't look right to me.

Maybe you meant:
ActiveCell.Offset(-1, 0).Value = d

Or maybe you wanted to do a comparison...

But if I were looking for a specific value, I think I'd use a different
technique--either looping through the cells, or using application.match() or
rng.Find...

But I'm not sure what you're doing. You may want to describe what you want.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top