selecting a non-empty range of cells

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The very useful short-cut keystroke CTRL-SHIFT and DOWN/UP selects a range
of cells with data in it. How can this action be repeated in a macro?
(Record_Macro returns the absolute range).

I need to return a cell count to manipulate data associated with this
selected range.

Thanks
 
Hi!

Sub SelectionUp()
Range(ActiveCell, ActiveCell.End(xlUp)).Select
End Sub


Sub SelectionDown()
Range(ActiveCell, ActiveCell.End(xlDown)).Select
End Sub

Starwing
 
Thanks

Though am getting an error when attempting this..xlRight
Is this an incorrect method? (see below)

M

Sub CountMonth()
' Returns Run Length and No.of Columns in RSM file
Dim CntMon
Dim CntRsm

ActiveSheet.Range("B7").Select
Range(ActiveCell, ActiveCell.End(xlDown)).Select
CntMon = Selection.Count
ERROR Range(ActiveCell, ActiveCell.End(xlRight)).Select ERROR
CntRsm = Selection.Count
End Sub
 
Mourinho,
Not xlRight, but xlToRight, xlToLeft,xlUp,xlDown.
Jorge
 

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

Back
Top