Hello,
I am new to using arrays in vba. I am trying to add sheet names to an array once I have declared one. Here is the code I have so far...
I get the following Run-time error '451': Property let procedure not defined and property get procedure did not return an object
...I get this when the if statement is true.
Does anyone have any wisdom to share whith a novice?
Lee
I am new to using arrays in vba. I am trying to add sheet names to an array once I have declared one. Here is the code I have so far...
I get the following Run-time error '451': Property let procedure not defined and property get procedure did not return an object
...I get this when the if statement is true.
Does anyone have any wisdom to share whith a novice?
Lee
Sub TestArray()
Dim intSheetCount As Integer
Dim SheetNumber As Integer
'Dim intLoopCounter As Integer
'Dim intSelectedCounter As Integer
Dim OwnerName As String ' Is the Report Owner for whom I am selecting reports
Dim SheetName As String 'Active Worksheet Name
Dim OwnerReports() As String 'OwnerReports is my array
intSheetCount = ActiveWorkbook.Sheets.Count - 2
SheetNumber = ActiveSheet.Index
OwnerName = Worksheets("CostCenterOwners").Cells(4, 2)
SheetName = ActiveSheet.Name
ActiveWorkbook.Worksheets("Summary").Activate
Do Until intSheetCount = SheetNumber
If Range("R7") = OwnerName Then 'Range("R7") is the location where the OwnerName is found on each sheet
OwnerReports(SheetName) = ActiveSheet.Name(SheetName) ' If Range("R7") on the active sheet = OwnerName then add the name of the shhet to my array
End If
ActiveSheet.Next.Activate
SheetNumber = ActiveSheet.Index
Namex = ActiveSheet.Name
Loop
Worksheets(OwnerReports).Select
End Sub
Last edited: