Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
Option Explicit
Sub mycollection()
Dim collection1 As New Collection
Dim MasterCollection As New Collection
Dim q As Byte
Dim myarray As Variant
Dim i As Integer
Dim myrange1 As Range
Dim Index As Variant
Dim MyRange As Range
Dim item As Collection
On Error Resume Next
myarray = Array("interstate", "offshore", "intrastate")
For i = 1 To ThisWorkbook.Sheets.Count
Set myrange1 = ThisWorkbook.Sheets(i).UsedRange.Find(what:="Usage")
If Not myrange1 Is Nothing Then
collection1.Add Sheets(i)
For Each Index In myarray
Set MyRange = ThisWorkbook.Sheets(i).UsedRange.Find(what:=Index)
If Not MyRange Is Nothing Then collection1.Add MyRange
Next Index
MasterCollection.Add collection1
Else
End If
Set collection1 = Nothing
Next i
For Each item In MasterCollection
For q = 2 To item.Count
MsgBox item(1).Name & " " & item(q).Address
Next q
Next item
End Sub
collection1.Add Sheets(i)
.Name
If Not MyRange Is Nothing Then collection1.Add MyRange
.Address
MsgBox item(1) & " " & item(q)
With Worksheets(item(1))
Set MyRange = .Range(item(q))
MsgBox item(1) & " " & MyRange.Address
End With