selecting cells
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 |
selecting cells
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 -- HTH. Best wishes Harald Followup to newsgroup only please. wrote in message om... 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 |
selecting cells
"Harald Staff" wrote in message ...
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 -- HTH. Best wishes Harald Followup to newsgroup only please. wrote in message om... 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 thx, that did it at the end! |
All times are GMT +1. The time now is 04:48 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com