doctorhifi
New Member
- Joined
- Aug 13, 2013
- Messages
- 19
Would someone tell me how to utilize an array or array(s) to speed this up?
VBA Code:
Set wsOutput = Sheets("NamedRanges")
With wsOutput
.Cells(1, "A") = "Name of all named range"
.Cells(1, "B") = "Address"
.Cells(1, "C") = "Row"
.Cells(1, "D") = "Column"
.Cells(1, "E") = "Value"
.Range(.Cells(1, "A"), .Cells(1, "E")).Font.Bold = True
End With
With ThisWorkbook
For Each nme In .Names
i = 0
On Error Resume Next
If Range(nme.Name).Worksheet.Name <> "Pricing Worksheet" Then GoTo skip
datastring2 = Range(nme.Name).Address(ReferenceStyle:=xlR1C1)
SearchString = ":"
i = InStr(1, datastring2, SearchString, vbTextCompare)
If i <> 0 Then
i = i - 1
datastring1 = Left(datastring2, i)
Else
datastring1 = Range(nme.Name).Address(ReferenceStyle:=xlR1C1)
End If
SearchString = "C"
z = InStr(1, datastring1, SearchString, vbTextCompare)
rope = Left(Range(nme.Name).Address(ReferenceStyle:=xlR1C1), z - 1)
Rope2 = Right(rope, Len(rope) - 1)
If Rope2 > 190 Then GoTo skip
Rope3 = Right(Len(datastring1), Len(datastring1) - i)
If Rope3 > 30 Then GoTo skip
On Error GoTo 0
With wsOutput
Set rngDestin = .Cells(.Rows.count, "A").End(xlUp).Offset(1, 0)
End With
On Error Resume Next
rngDestin = nme.Name
rngDestin.Offset(0, 1) = Range(nme.Name).Address(ReferenceStyle:=xlR1C1)
rngDestin.Offset(0, 2) = Rope2
rngDestin.Offset(0, 3) = Rope3
rngDestin.Offset(0, 4) = nme.Value
On Error GoTo 0
skip:
Next nme
End With
wsOutput.Columns.AutoFit
End Sub
Last edited by a moderator: