View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Help - selecting range

Sub across_and_down()
Set r = Range("C22")
For i = 4 To Columns.Count
If IsEmpty(Cells(22, i).Value) Then
Else
Set r = Union(r, Cells(22, i))
End If
Next

For i = 23 To Rows.Count
If IsEmpty(Cells(i, "C").Value) Then
Else
Set r = Union(r, Cells(i, "C"))
End If
Next
r.Select
End Sub


This macro will first move across row 22 starting from C22 and pick up cells
with data. The macro will then move down column C from C22 and pick up cells
with data
--
Gary''s Student - gsnu2007g


"MJKelly" wrote:

Hi,

I have a set of data which starts at C22. there is data in the cells
around this, but I am only interested in selecting the range C22 and
all cells containing data to the right and cells containing data below
cell C22. I have used xltoright and xldown before, but can't seem to
get them to work together to select a multi column/row range. The
number of columns and rows of data does change.


hope you can help?

Matt