Thread: Setting A Range
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
moon[_5_] moon[_5_] is offline
external usenet poster
 
Posts: 40
Default Setting A Range


Just pass the range as an argument in your sub...

Public Sub RangeDemo(r As Range)
Dim e As Variant 'every element in range
For Each e In r
MsgBox r.Value
Next
End Sub




"Reggie" schreef in bericht
...
Is is possible to to set a range in VB and have any sub use it? If so how
would i be able to do this? Code so far

Set plane = Worksheets("Sheet1").Range("A98")

i want the range "plane" to be used throughout the worksheet.