How to Loop and Read the Cell until the end of worksheet

  • Thread starter Thread starter hon123456
  • Start date Start date
H

hon123456

Dear all,

Suppose I have three columns of Data. Now I want to read
the first column and third
column. How can I write VBA code to loop the first column and third
column till the end of the
worksheet.? Here are my questions: How to determine there is an end in
worksheet?
How to loop the first column and third column cell by cell. Thanks.
 
One way

For Each cell In Range("A1").CurrentRegion

If cell.Column = 1 Or cell.Column = 3 Then
'do stuff
End If
Next cell

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

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

Back
Top