Thread: Inputbox
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Inputbox

Oops, forgot to edit: in the second function, substitute

With wkSht.Range(rng.Address)
'do something, presumably
End With

For

wkSht.Range(rng.Address).Select



In article ,
JE McGimpsey wrote:

One way:

To select "rng on the activesheet":

Dim rng As Range
On Error Resume Next 'in case user clicks Cancel
Set rng = Application.InputBox(Prompt:="prompt:", Type:=8)
On Error GoTo 0
If Not rng Is Nothing Then _
ActiveSheet.Range(rng.Address).Select

Not sure how that squares with your wanting "to select C8 on each sheet
using a for each statement", which would be more like:

Dim wkSht As Worksheet
Dim rng As Range
On Error Resume Next 'in case user clicks Cancel
Set rng = Application.InputBox(Prompt:="prompt:", Type:=8)
On Error GoTo 0
If Not rng Is Nothing Then
For Each wkSht In Worksheets
wkSht.Range(rng.Address).Select
'do something, presumably
Next wkSht
End If