PDA

View Full Version : [SOLVED:] Select Active cell to top cell



pcarmour
04-13-2016, 07:26 AM
Hi,
I feel this should be something simple but I can't get it right.
I want to select a range from the active cell to the top cell in its column, such as Range(ActiveCell, ActiveCell.R1).Select.
Range(ActiveCell, ActiveCell.End(xlUp)).Select - is no good as there are empty cells in the range. I've also tried to use TopCell but with no luck.



Any help as always very much appreciated.


System Info:
Excel 2013
OS Name Microsoft Windows 7 Professional
Version 6.1.7601 Service Pack 1 Build 7601
Installed Physical Memory (RAM) 4.00 GB
Total Physical Memory 3.96 GB
Available Physical Memory 1.45 GB
System Type x64-based PC
Processor Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz, 3301 Mhz, 4 Core(s), 4 Logical Processor(s)

Paul_Hossler
04-13-2016, 08:02 AM
maybe this




Option Explicit
Sub test()

Range(Cells(1, ActiveCell.Column), ActiveCell).Select
MsgBox Selection.Address

End Sub

pcarmour
04-13-2016, 08:23 AM
Thank you Paul, works brilliantly.