Thread
:
Creating an array based on worksheet index
View Single Post
#
3
Posted to microsoft.public.excel.programming
ALEX
external usenet poster
Posts: 493
Creating an array based on worksheet index
The code I have I know is a little on the confusing side.
This should be an array that stores the worksheet name.
I'm trying to get the array to be variable based on the workbook index.
"Don Guillett" wrote:
try this
Sub sheetnames()
For Each WS In Sheets
WS.Range("a10") = WS.Index
Next
End Sub
--
Don Guillett
SalesAid Software
"Alex" wrote in message
...
I'm trying to create an array based on the names of the worksheets in a
workbook, using the index as the variable.
I keep getting a "constant" error, can I create a array this way?
Sub test2()
Dim wrksht(num)
Dim num As Byte
Dim WS As Worksheet
num = ActiveWorkbook.Worksheets.Count
For Each WS In Worksheets
wrksht(num) = WS.name + 1
Range("A10").Formula = wrksht(num)
ActiveCell.Offset(1, 0).Select
Next WS
End Sub
THANK YOU!!
--
Jack of all trades... master of none..
Reply With Quote
ALEX
View Public Profile
Find all posts by ALEX