View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone[_2_] Jim Cone[_2_] is offline
external usenet poster
 
Posts: 1,549
Default Looking for a way to Set Range to Entire Column


ColA is returning a column not the cells in the column.
Try... Msgbox ColA.Count
and then make two changes...

Dim R as Range
Set ColA = ActiveSheet.Columns(1).Cells

Now again try... Msgbox ColA.Count
--
Jim Cone
Portland, Oregon USA



"Dan Thompson"

wrote in message
Here is my code

Sub Temp()
Dim R
'Set ColA = ActiveSheet.Range("A1:A65536")
Set ColA = ActiveSheet.Columns(1).EntireColumn


For Each R In ColA
If R.Text = "" Then
endrow = R.Row - 1
Exit For
End If
Next
MsgBox endrow
End Sub

The first line I have rem'ed out was what I originally was using and it does
work for this code however I was hoping that I could do the same thing by
using just a column reference to set my range for the rest of my code but
when I use the second line after the rem'ed out line it doesn't return the
same as my original line of code. Can I use somthing like the second line of
my code or do I have to use the first one to set my range ?

Dan Thompson