Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Excel Selection in VBA

What is the proper method for doing a selection that is the equivalent of
manually using the ctrl, shift and down arrow keys to select from the
starting point to the end of the data? I have a macro that works and tried
to modify that code to work, but have not been successful. The pointer moves
to cell K2 but the selection doesn't work. After it is selected I'm planning
to change the format of the column of data.

Thanks,

xls is an object that is the worksheet selected from the excel object.

xls.Range("K2").Select
xls.Range(Selection, Selection.End(xlDown)).Select
xls.Selection.NumberFormat = "0"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default Excel Selection in VBA

Jeep,

you are better off avoiding selection statements completely. This will
format the range you want directly.

with xls
.range(.range("k2"),.range("k2").End(xlDown)).numb erformat = "0"
end with

Robin Hammond
www.enhanceddatasystems.com

"JeepNC" wrote in message
...
What is the proper method for doing a selection that is the equivalent of
manually using the ctrl, shift and down arrow keys to select from the
starting point to the end of the data? I have a macro that works and
tried
to modify that code to work, but have not been successful. The pointer
moves
to cell K2 but the selection doesn't work. After it is selected I'm
planning
to change the format of the column of data.

Thanks,

xls is an object that is the worksheet selected from the excel object.

xls.Range("K2").Select
xls.Range(Selection, Selection.End(xlDown)).Select
xls.Selection.NumberFormat = "0"



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
Limiting selection in a cell AND linking that selection to a list Lisa Excel Discussion (Misc queries) 1 July 28th 09 05:00 PM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
Identifying a selection of a selection of a range swimfast Excel Worksheet Functions 1 March 1st 07 02:51 AM
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. jonH Excel Programming 3 June 7th 04 09:13 PM
Excel VBA : Sheet selection vlbaranov Excel Programming 9 June 1st 04 01:17 PM


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

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"