Autofill until last cell in a row

L

Little Penny

In vba how do I:

Change the contents of cell E1 and F1 to the number o (zero) and the
autofill the contents the the last cell in each row.


Thanks
 
D

Dave Peterson

I used column A to find out the last used row.

Dim LastRow as long
with worksheets("Somesheetnamehere")
lastrow = .cells(.rows.count,"A").end(xlup).row

.range("e1:f" & lastrow).value = 0
end with

You can fill the whole range at once instead of using autofill.
 

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