Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Base 1
- Function addNames()
- Dim gNamesInBook()
- Dim gNamesToAdd()
- Dim tempNameArray()
- Dim namesAdded()
- Dim cWorkbookNames As Integer
- Dim cNamesToAdd As Integer
- cWorkbookNames = ActiveWorkbook.Names.Count
- cNamesToAdd = Sheets("HiddenVariables").Range(Cells(10000, 1).End(xlUp), Cells(2, 1)).Count
- ReDim gNamesInBook(cWorkbookNames)
- ReDim gNamesToAdd(cNamesToAdd)
- ReDim tempNameArray(cWorkbookNames)
- 'MsgBox UBound(tempNameArray)
- gNamesInBook = gatherNames(gNamesInBook())
- namesAdded = addNamesToBook(gNamesInBook())
- putGatheredInCells gNamesInBook
- End Function
- Function gatherNames(ByRef passedArray())
- For i = LBound(passedArray) To UBound(passedArray)
- passedArray(i) = _
- ActiveWorkbook.Names(i).Index & ": " & _
- ActiveWorkbook.Names(i).Name & "; \n" & _
- ActiveWorkbook.Names(i).RefersTo & "."
- Next i
- gatherNames = passedArray
- End Function
- Sub putGatheredInCells(ByRef passTheNames())
- For i = LBound(passTheNames) To UBound(passTheNames)
- ActiveSheet.Cells(i, 3).Value = passTheNames(i)
- Next i
- End Sub
- Sub selectRange()
- Sheets("HiddenVariables").Range(Cells(10000, 1).End(xlUp), Cells(2, 1)).Select
- End Sub
- Function addNamesToBook(ByRef passTheNames())
- For i = LBound(passTheNames) To UBound(passTheNames)
- pulledName = Left(Split(passTheNames(i), ":"), UBound(passTheNames))
- ActiveWorkbook.Names.Add Name:=pulledName, RefersTo:=pulledReferral
- Next i
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement