Isolating a row/column in a range

  • Thread starter Thread starter Arun
  • Start date Start date
A

Arun

Is there a function in VBA that will break out a subset of a range. For
example, I have a 5 x 10 range and would like to create a 'vector' of the
first row, thereby getting a 1 x 10 range that containes only the headers.

This can be done using the index function within Excel : Index (Rng,1,) or
Index(Rng,2,) to get the second row, or (Rng,,3) to get the third column.
However, it only works with the columns in VBA for some reason.

Thanks.
 
Dim rng As Range, rngHeaders As Range
Set rng = Range("A1:J5")
Set rngHeaders = rng.Rows(1)
MsgBox rngHeaders.Address
 

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