View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Selecting all the active cells in a named column.

If you want a macro to ask the user...

Option Explicit
Sub testme()

Dim myCell As Range
Dim myRng As Range

Set myCell = Nothing
On Error Resume Next
Set myCell = Application.InputBox(Prompt:="Please select a column", _
Type:=8).Cells(1)
On Error GoTo 0

If myCell Is Nothing Then
Beep 'user hit cancel
Exit Sub
End If

With myCell.Parent
Set myRng = .Range(.Cells(1, myCell.Column), _
.Cells(.Rows.Count, myCell.Column).End(xlUp))
End With

Application.Goto myRng

End Sub

Colin Hayes wrote:

Hi

I have a small problem. I need to have a macro which can fulfil the
following , if possible.

I need to select all the cells in a named column. Not the whole column ,
but just those cells with content.

Perhaps the macro could request the column to act on , and then the
macro would select from cell 1 down to the last cell with content.

Can someone help with this?

Grateful for any advice.

Best Wishes


--

Dave Peterson