![]() |
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 |
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 |
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 . |
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 . . |
All times are GMT +1. The time now is 01:24 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com