Setting a range using VBA

E

elswen

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
 
D

Don Guillett

try

Sub selectit()
x = ActiveSheet.UsedRange.Rows.Count
Range(Cells(2, 1), Cells(x, 1)).Select
End Sub
 
K

Kevin Beckham

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
(e-mail address removed)
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


.
 
D

Don Guillett

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

--
Don Guillett
SalesAid Software
(e-mail address removed)
Kevin Beckham said:
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
(e-mail address removed)
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


.
 
G

Guest

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
(e-mail address removed)
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
(e-mail address removed)
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


.


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top