I am getting an 'Application or Object Defined Error' message in the below function, which is writing variables back to a sheet. I have tried several combinations of Sheets vs Worksheets collections and Range vs Cells objects, but still recieve the same error. The logs confirm that the the issue is coming in the lines beginning with the call to .Range, and all custom objects and methods being utilized have been unit tested. I'm quite confidant that the issue is coming from an incorrect use of the above built-in variables, but I'm struggling to find the correct syntax. Assistance would be much appreciated!
Public Function LoadWorkflowIntoEditor(analysisWorkflowName As String)
'
'Load an existing workflow into the workflow editor in the list view
'
WriteLogs ("LoadWorkflowIntoEditor Called")
Dim tempAnalysisSet As Collection
Set tempAnalysisSet = New Collection
Dim tempKeyAction As AnalysisKeyAction
Set tempKeyAction = New AnalysisKeyAction
With Worksheets(WorkflowSheetName)
For i = 1 To Master_FlowList.GetWorkflowByName(analysisWorkflowName).NumberOfKeyActions
WriteLogs ("List Editor Row " & i & "Population Initiated")
Set tempKeyAction = Master_FlowList.GetWorkflowByName(analysisWorkflowName).GetKeyActionByIndex(i)
WriteLogs ("Key Action Pulled from Workflow List")
Set tempAnalysisSet = Master_ModuleList.FindAnalysisSetByKeyActionName(tempKeyAction.AKeyActionName)
WriteLogs ("Analysis Set pulled from Module List")
.Range(.Cells(i + ListEditorStartRowNumber_WF, WorkflowColumnNumber_WF)).Value = CurrentWorkflowName
.Range(.Cells(i + ListEditorStartRowNumber_WF, ModuleColumnNumber_WF)).Value = tempAnalysisSet.Item("Module")
.Range(.Cells(i + ListEditorStartRowNumber_WF, SystemAreaColumnNumber_WF)).Value = tempAnalysisSet.Item("System Area")
.Range(.Cells(i + ListEditorStartRowNumber_WF, KeyActionColumnNumber_WF)).Value = tempAnalysisSet.Item("Key Action")
.Range(.Cells(i + ListEditorStartRowNumber_WF, KeyActionDescriptionColumnNumber_WF)).Value = tempKeyAction.AKeyActionDescription
.Range(.Cells(i + ListEditorStartRowNumber_WF, KeyActionExpectedResultColumnNumber_WF)).Value = tempKeyAction.AKeyActionExpectedResult
.Range(.Cells(i + ListEditorStartRowNumber_WF, NextKeyActionColumnNumber_WF)).Value = NextKeyActionListToString(tempKeyAction.GetNextKeyActionList, IPDelimiterCharacter)
Next i
End With
WriteLogs ("Workflow loaded into list editor")
End Function
Alex
With Worksheets(WorkflowSheetName)is not pointing to the proper sheet hence not defining the object of the.Range? From where are you getting the value ofWorkflowSheetName?WorkflowSheetNameand when running the script what value is it populating?