L
layla
Hi,
How can I write this
alist is the name of my list)-I want the first
row of alist
set firstRow=alist.row(1)
How can I write this
row of alist
set firstRow=alist.row(1)
Hi,
How can I write thisalist is the name of my list)-I want the first
row of alist
set firstRow=alist.row(1)
layla said:to be more percise I need the range for the first row of the list
Assuming you mean to do this in VBA, there are many, many ways. This is
probably the easiest:
Dim firstRow As Range
Set firstRow = alist.resize(1)
More generally, if n is the row in the list, one way:
Dim firstRow As Range
With alist
Set firstRow = .Cells(n, 1).Resize(1, .Columns.Count)
End With
I think you want: set firstrow=alist.row(1).rownon of the codes work
Bob Greenblatt said:I think you want: set firstrow=alist.row(1).row
OOPS, sorry, Yes, of course you are right John, my bad.Not sure what that would do...
Assuming you meant
set firstrow=alist.rows(1).row
the right side still returns a Long, not an object (which "set"
requires).
And the OP said they wanted "the range for the first row".
My belt and suspenders approach could have been overkill for
Set firstrow = alist.Rows(1)
but I prefer it to using .Rows(1), since it produces a range of cells
rather than a single row object.