K
Ken Marshall
I am trying to design a form with a spreadsheet on a page, and be able to
programmatically work with it. I found this code in the help file, but it
gives me an error.
Sub List_All_Names()
Dim nmCurrentName
Dim rngCurrent
Set rngCurrent = Spreadsheet1.ActiveSheet.Range("A1")
' Loop through all of the names in the active workbook.
For Each nmCurrentName In Spreadsheet1.ActiveWorkbook.Names
' Write the current name to the worksheet.
rngCurrent.Value = nmCurrentName.Name
' Write the definition of the current name to the worksheet.
rngCurrent.Offset(0, 1).Value = "'" & nmCurrentName.RefersTo
Set rngCurrent = rngCurrent.Offset(1, 0)
Next
End Sub
When it gets to the set statement, it ends with the error "object required."
There is obviously something I am missing, perhaps another set statement, or
perhaps a reference I need to make in the Tools/References list.
Your help is appreciated.
Neil
programmatically work with it. I found this code in the help file, but it
gives me an error.
Sub List_All_Names()
Dim nmCurrentName
Dim rngCurrent
Set rngCurrent = Spreadsheet1.ActiveSheet.Range("A1")
' Loop through all of the names in the active workbook.
For Each nmCurrentName In Spreadsheet1.ActiveWorkbook.Names
' Write the current name to the worksheet.
rngCurrent.Value = nmCurrentName.Name
' Write the definition of the current name to the worksheet.
rngCurrent.Offset(0, 1).Value = "'" & nmCurrentName.RefersTo
Set rngCurrent = rngCurrent.Offset(1, 0)
Next
End Sub
When it gets to the set statement, it ends with the error "object required."
There is obviously something I am missing, perhaps another set statement, or
perhaps a reference I need to make in the Tools/References list.
Your help is appreciated.
Neil