ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selection (https://www.excelbanter.com/excel-programming/373689-selection.html)

kirke

Selection
 
I want to select columnes from C to unknown.
Thus, I want to define it like following:

Range("C1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select

However, it doesn't work properly, The result is

Range("C1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select

Thus, I record the macro and replay it. However, also doesn't work.
Sometimes, it works, and suddenly it doesn't work. and that's now. It
makes me crazy !
Is there some setting for using this? Or is there other method?
I always appreciate peoples answer from here! It's really really
helpful!!!!!
Thx.


Greg Glynn

Selection
 
Maybe play around with the CurrentRegion property

Range("C1").Activate
ActiveCell.CurrentRegion.Select

See how you go with that.

Greg

kirke wrote:
I want to select columnes from C to unknown.
Thus, I want to define it like following:

Range("C1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select

However, it doesn't work properly, The result is

Range("C1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select

Thus, I record the macro and replay it. However, also doesn't work.
Sometimes, it works, and suddenly it doesn't work. and that's now. It
makes me crazy !
Is there some setting for using this? Or is there other method?
I always appreciate peoples answer from here! It's really really
helpful!!!!!
Thx.



kirke

Selection
 
Yes. It works.
However, I miss something. I have another data on column A and B which
don't want to be selected.
Thx.


Greg Glynn wrote:
Maybe play around with the CurrentRegion property

Range("C1").Activate
ActiveCell.CurrentRegion.Select

See how you go with that.

Greg

kirke wrote:
I want to select columnes from C to unknown.
Thus, I want to define it like following:

Range("C1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select

However, it doesn't work properly, The result is

Range("C1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select

Thus, I record the macro and replay it. However, also doesn't work.
Sometimes, it works, and suddenly it doesn't work. and that's now. It
makes me crazy !
Is there some setting for using this? Or is there other method?
I always appreciate peoples answer from here! It's really really
helpful!!!!!
Thx.



PapaDos

Selection
 
Range("C1", Range("C1").End(xlToRight).End(xlDown).End(xlDown) ).Select

--
Festina Lente


"kirke" wrote:

I want to select columnes from C to unknown.
Thus, I want to define it like following:

Range("C1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select

However, it doesn't work properly, The result is

Range("C1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select

Thus, I record the macro and replay it. However, also doesn't work.
Sometimes, it works, and suddenly it doesn't work. and that's now. It
makes me crazy !
Is there some setting for using this? Or is there other method?
I always appreciate peoples answer from here! It's really really
helpful!!!!!
Thx.



kirke

Selection
 
Thx! This perfectly work!

Well then, don't you the reason know why mine doesn't work? it looks
similar with yours~~


PapaDos wrote:
Range("C1", Range("C1").End(xlToRight).End(xlDown).End(xlDown) ).Select

--
Festina Lente


"kirke" wrote:

I want to select columnes from C to unknown.
Thus, I want to define it like following:

Range("C1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select

However, it doesn't work properly, The result is

Range("C1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select

Thus, I record the macro and replay it. However, also doesn't work.
Sometimes, it works, and suddenly it doesn't work. and that's now. It
makes me crazy !
Is there some setting for using this? Or is there other method?
I always appreciate peoples answer from here! It's really really
helpful!!!!!
Thx.




sonu[_2_]

Selection
 
try using usedRane. You can read about it more in help section.

Worksheets("Sheet1").Activate
ActiveSheet.UsedRange.Select


kirke wrote:
Thx! This perfectly work!

Well then, don't you the reason know why mine doesn't work? it looks
similar with yours~~


PapaDos wrote:
Range("C1", Range("C1").End(xlToRight).End(xlDown).End(xlDown) ).Select

--
Festina Lente


"kirke" wrote:

I want to select columnes from C to unknown.
Thus, I want to define it like following:

Range("C1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select

However, it doesn't work properly, The result is

Range("C1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select

Thus, I record the macro and replay it. However, also doesn't work.
Sometimes, it works, and suddenly it doesn't work. and that's now. It
makes me crazy !
Is there some setting for using this? Or is there other method?
I always appreciate peoples answer from here! It's really really
helpful!!!!!
Thx.




PapaDos

Selection
 
Selection.End(xlDown) works from the first cell in the selected range...
--
Festina Lente


"kirke" wrote:

Thx! This perfectly work!

Well then, don't you the reason know why mine doesn't work? it looks
similar with yours~~


PapaDos wrote:
Range("C1", Range("C1").End(xlToRight).End(xlDown).End(xlDown) ).Select

--
Festina Lente


"kirke" wrote:

I want to select columnes from C to unknown.
Thus, I want to define it like following:

Range("C1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select

However, it doesn't work properly, The result is

Range("C1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select

Thus, I record the macro and replay it. However, also doesn't work.
Sometimes, it works, and suddenly it doesn't work. and that's now. It
makes me crazy !
Is there some setting for using this? Or is there other method?
I always appreciate peoples answer from here! It's really really
helpful!!!!!
Thx.






All times are GMT +1. The time now is 12:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com