Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Setting a range using VBA

How can I goto A2 then emulate the keystrokes [Control]
[Shift][End] then [Shift][Home] tocapture column A for
the height of the data using VBA?
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Setting a range using VBA

try

Sub selectit()
x = ActiveSheet.UsedRange.Rows.Count
Range(Cells(2, 1), Cells(x, 1)).Select
End Sub
--
Don Guillett
SalesAid Software

" wrote in message
...
How can I goto A2 then emulate the keystrokes [Control]
[Shift][End] then [Shift][Home] tocapture column A for
the height of the data using VBA?
Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Setting a range using VBA

I suggest this code if the data is continuous (no empty
cells)
Dim rng As Range
Set rng = Range(Range("A2"),Range("A2").End(xlDown))

or if not continuous
Dim rng As Range
Set rng = Range(Range("A2"),Range("A65536").End(xlUp))

Kevin Beckham

-----Original Message-----
try

Sub selectit()
x = ActiveSheet.UsedRange.Rows.Count
Range(Cells(2, 1), Cells(x, 1)).Select
End Sub
--
Don Guillett
SalesAid Software

"

wrote in message
...
How can I goto A2 then emulate the keystrokes [Control]
[Shift][End] then [Shift][Home] tocapture column A for
the height of the data using VBA?
Thanks



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Setting a range using VBA

Don,
You're right, it's just that I never consider empty
formatted cells to be "useful" .

Kevin
-----Original Message-----
Kevin,
Perhaps a re-reading of OP's request would be helpful for

you.

--
Don Guillett
SalesAid Software

"Kevin Beckham"

wrote in message
...
I suggest this code if the data is continuous (no empty
cells)
Dim rng As Range
Set rng = Range(Range("A2"),Range("A2").End(xlDown))

or if not continuous
Dim rng As Range
Set rng = Range(Range("A2"),Range("A65536").End(xlUp))

Kevin Beckham

-----Original Message-----
try

Sub selectit()
x = ActiveSheet.UsedRange.Rows.Count
Range(Cells(2, 1), Cells(x, 1)).Select
End Sub
--
Don Guillett
SalesAid Software

"

wrote in message
...
How can I goto A2 then emulate the keystrokes

[Control]
[Shift][End] then [Shift][Home] tocapture column A

for
the height of the data using VBA?
Thanks


.



.

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
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
VBA setting Range Jeff Excel Discussion (Misc queries) 1 December 2nd 05 07:36 PM
VBA setting range in another sheet Jeff Excel Discussion (Misc queries) 2 October 14th 05 02:11 PM
Setting print range using VBA Ron de Bruin Excel Programming 0 July 29th 03 03:59 PM
Setting Print range Tom Ogilvy Excel Programming 3 July 25th 03 04:06 AM


All times are GMT +1. The time now is 11:45 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"