vba - Run-time error '91' ... attempting to index multiple columns -
the following snippet giving me "object variable or block variable not set" error
cindx = wsmain.range(cells(i, begcol), cells(i, endcol)).find("churn", matchcase:=true, lookin:=xlformulas, lookat:=xlwhole) if not cindx nothing if wsmain.cells(i, statuscol) = "active" wsmain.cells(i, cindx.column) = " " end if end if
the first line culprit. research far suggests has way i'm indexing range official documentation says i'm attempting possible. i've reviewed posts find on here same title mine none of them appear directly applicable situation. insights appreciated. happy post surrounding code if more context helpful.
also curious whether can this:
with wsmain cindx = .range(cells(i, begcol), cells(i, endcol)).find("churn", matchcase:=true, lookin:=xlformulas, lookat:=xlwhole) if not cindx nothing if .cells(i, statuscol) = "active" .cells(i, cindx.column) = " " end if end if end
yields same error above
in regular code module, cells()
without qualifying worksheet refer activesheet, need qualify calls. need use set when assigning value object-type variable.
set cindx = wsmain.range(wsmain.cells(i, begcol), wsmain.cells(i, endcol)).find( _ "churn", matchcase:=true, lookin:=xlformulas, lookat:=xlwhole) if not cindx nothing if wsmain.cells(i, statuscol) = "active" wsmain.cells(i, cindx.column) = " " end if end if
Comments
Post a Comment