selecting cells

  • Thread starter Thread starter philipl
  • Start date Start date
P

philipl

hi

I have need to select two columns from a spreadsheet, I don't know how
long these columns are going to be until runtime. I would like to be
able to select this at run time so I can write out to a text file.

I am able to get the last value in one column by using range and
intersect. And the other one this way too, so with this I should be
able to work out the cordinates for my selection area.

this seems a liitle long winded, does anyone else out there have a
better way of doing this?

thx
-Philip
 
Hi Philip

See if this is of help. It does contain Intersect cose, so you may not like it.

Sub TestSelect()
Dim C As Range, R As Range
On Error Resume Next
Set C = Application.InputBox _
("Click some column headers please:", Type:=8)
If C Is Nothing Then Exit Sub
Set R = Intersect(C, ActiveSheet.UsedRange)
R.Select
MsgBox Selection.Address & " is pretty tonight."
End Sub
 
Harald Staff said:
Hi Philip

See if this is of help. It does contain Intersect cose, so you may not like it.

Sub TestSelect()
Dim C As Range, R As Range
On Error Resume Next
Set C = Application.InputBox _
("Click some column headers please:", Type:=8)
If C Is Nothing Then Exit Sub
Set R = Intersect(C, ActiveSheet.UsedRange)
R.Select
MsgBox Selection.Address & " is pretty tonight."
End Sub


thx, that did it at the end!
 
Back
Top