Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22
Default Selection problem with recorder

My data distribution looks like this:

Col1 Col2 Col3 -------- Col20 Col21 Col22 Col23
data1 data3 -------- data20
data23

Using the Macro recorder , I selected data1 to data23, by pressing
Ctrl-Shift and the right pointing arrow (=) three times. The relevent codes
generated are as follows:

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

However, when I executed them, Excel carried out the first line correctly
but stepped over the last two lines without carrying them out. What's wrong?
There will always be 3 blank columns, but more columns will be added after
Col20 to accept more data. Hence, Range("A1:W1").Select can't be used. Any
suggestion is much appreciated.

Brian




  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 27,285
Default Selection problem with recorder

Range(Cells(1,1),Cells(1,"IV").End(xltoLeft)).Sele ct

--
Regards,
Tom Ogilvy


"Brian" wrote in message
...
My data distribution looks like this:

Col1 Col2 Col3 -------- Col20 Col21 Col22 Col23
data1 data3 -------- data20 data23

Using the Macro recorder , I selected data1 to data23, by pressing
Ctrl-Shift and the right pointing arrow (=) three times. The relevent
codes generated are as follows:

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

However, when I executed them, Excel carried out the first line correctly
but stepped over the last two lines without carrying them out. What's
wrong?
There will always be 3 blank columns, but more columns will be added after
Col20 to accept more data. Hence, Range("A1:W1").Select can't be used. Any
suggestion is much appreciated.

Brian






  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22
Default Selection problem with recorder

"Tom Ogilvy" wrote in message
...
Range(Cells(1,1),Cells(1,"IV").End(xltoLeft)).Sele ct


This is ok if data1 is in Row 1. Sorry for not being more specific.
My data1 can be in any random row location, resulting from a sort.
Therefore, I need to select from the position of the active cell across
to the right.

Thanx
Brian

--
Regards,
Tom Ogilvy


"Brian" wrote in message
...
My data distribution looks like this:

Col1 Col2 Col3 -------- Col20 Col21 Col22 Col23
data1 data3 -------- data20 data23

Using the Macro recorder , I selected data1 to data23, by pressing
Ctrl-Shift and the right pointing arrow (=) three times. The relevent
codes generated are as follows:

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

However, when I executed them, Excel carried out the first line correctly
but stepped over the last two lines without carrying them out. What's
wrong?
There will always be 3 blank columns, but more columns will be added
after Col20 to accept more data. Hence, Range("A1:W1").Select can't be
used. Any suggestion is much appreciated.

Brian








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with MS Community Newsgroups? [email protected] Excel Discussion (Misc queries) 4 May 14th 06 04:38 PM
Finding a Problem Link in Excel Tracy B. Excel Discussion (Misc queries) 3 May 2nd 06 07:18 PM
Problem with Pasting Data Addy Setting up and Configuration of Excel 0 April 26th 06 06:18 PM
strange problem with links updates in excel [email protected] Excel Discussion (Misc queries) 1 April 23rd 06 10:59 AM
Freeze Pane problem in shared workbooks JM Excel Discussion (Misc queries) 1 February 1st 05 12:04 AM


All times are GMT +1. The time now is 03:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"