View Single Post
  #5   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

Dear Ken,
Thanks again. could you please let me know if theres a way to select
the range in another open work book. i.e. the code is in file w1.xls
and I want to select the range in file w2.xls.
Thank you very much.
Reza

Ken Johnson wrote:
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