View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
A.W.J. Ales A.W.J. Ales is offline
external usenet poster
 
Posts: 63
Default Trouble with columns and for each

Fernando,

I assume that you want your cells ( in the first column of your current
region) selected one by one.

If so, try :

Option Explicit
Sub Test()
Dim NrRows As Integer, I As Integer
Dim myrange As Range
Set myrange = Range("B2").CurrentRegion.Columns(1)
NrRows = myrange.Rows.Count
For I = 1 To NrRows
Cells(I, 1).Select
Next
End Sub

--
Regards,
Auk Ales

* Please reply to this newsgroup only *
* I will not react on unsolicited e-mails *

"Fernando Ortiz" wrote in message
...
Hi Excel experts

I working on this code and i don't know why no run well.

I have a lot data in the Current region

Option Explicit

Sub Test()
Dim myrange As Range
Dim mycell As Range
Set myrange = Range("B2").CurrentRegion.Columns(1)
For Each mycell In myrange
mycell.Select
Next mycell
End Sub

Thanks for your expert advice


Regards


Fernando