gruntingmonkey
Active Member
- Joined
- Mar 6, 2008
- Messages
- 444
- Office Version
- 365
- Platform
- Windows
Hello, I have an issue where I have a list on an excel sheet which I need to transpose to put in an array (sheet names) but it loses any leading 0s which means it doesn't recognise the tabs.
It debugs on the last line with a Run-time error 9, Subscript out of range.
Can anyone help?
Code:
Dim oWS As Worksheet
Dim aSheetnames As Variant
Set oWS = Worksheets("Compiler")
endrow = ActiveSheet.Cells(Rows.Count, "O").End(xlUp).Row
aSheetnames = oWS.Range("O16:o" & endrow & "")
aSheetnames = Application.WorksheetFunction.Transpose(aSheetnames)
Worksheets(aSheetnames).Select
It debugs on the last line with a Run-time error 9, Subscript out of range.
Can anyone help?