Excel VBA Application or Object-Defined Error - Writing Variable Values to Sheets -
i getting 'application or object defined error' message in below function, writing variables sheet. have tried several combinations of sheets vs worksheets collections , range vs cells objects, still recieve same error. logs confirm the issue coming in lines beginning call .range, , custom objects , methods being utilized have been unit tested. i'm quite confidant issue coming incorrect use of above built-in variables, i'm struggling find correct syntax. assistance appreciated!
public function loadworkflowintoeditor(analysisworkflowname string) ' 'load existing workflow workflow editor in list view ' writelogs ("loadworkflowintoeditor called") dim tempanalysisset collection set tempanalysisset = new collection dim tempkeyaction analysiskeyaction set tempkeyaction = new analysiskeyaction worksheets(workflowsheetname) = 1 master_flowlist.getworkflowbyname(analysisworkflowname).numberofkeyactions writelogs ("list editor row " & & "population initiated") set tempkeyaction = master_flowlist.getworkflowbyname(analysisworkflowname).getkeyactionbyindex(i) writelogs ("key action pulled workflow list") set tempanalysisset = master_modulelist.findanalysissetbykeyactionname(tempkeyaction.akeyactionname) writelogs ("analysis set pulled 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 end writelogs ("workflow loaded list editor") end function
alex
this:
.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)
could simpler using block:
with .rows(i + listeditorstartrownumber_wf) .cells(workflowcolumnnumber_wf).value = currentworkflowname .cells(modulecolumnnumber_wf).value = tempanalysisset.item("module") .cells(systemareacolumnnumber_wf).value = tempanalysisset.item("system area") .cells(keyactioncolumnnumber_wf).value = tempanalysisset.item("key action") .cells(keyactiondescriptioncolumnnumber_wf).value = tempkeyaction.akeyactiondescription .cells(keyactionexpectedresultcolumnnumber_wf).value = tempkeyaction.akeyactionexpectedresult .cells(nextkeyactioncolumnnumber_wf).value = nextkeyactionlisttostring( _ tempkeyaction.getnextkeyactionlist, ipdelimitercharacter) end
...and removing .range(.cells(...))
pointed out @sorceri
Comments
Post a Comment