View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
rezafloyd rezafloyd is offline
external usenet poster
 
Posts: 10
Default Selececting a cell/range onscreen through vba

Hi Ken,
Thanks a lot
Reza

here is a trivial example of code that prompts the user to select a
range of cells for processing. If a new range of cells is not selected
when prompted the current selection is the default range that is
processed...

Public Sub ChosenCells()
Dim rngWhatCells As Range
On Error GoTo CANCELLED
Set rngWhatCells = Application.InputBox( _
Prompt:="Select Cells for processing.", _
Title:="What Cells?", _
Default:=Selection.Address, _
Type:=8)
rngWhatCells.Value = "I'm a chosen cell"
CANCELLED:
End Sub

Ken Johnson