Method or data member Issue with my Excel VBA Code -


hello started program macro , have come across error stating method or data member not found , pointing me following line in code:

set wssheet = wstpcc.sheets("tpcc") 

i clueless why might happening , have assistance in figuring out throughout rest of programming beginning of code. here whole code in case.

option explicit sub traininghoursmacro()  dim wbthmacro workbook, wsregulares worksheet, wsregularesdemitidos worksheet, wstempactivos worksheet, wstempja worksheet, wstempfit worksheet, _     wstempdemitidos worksheet, wsps worksheet, wsresultados worksheet, wsdllist worksheet, wssheet worksheet dim wbregularesbruto workbook, wsmovimentacao worksheet, wsdemitidos worksheet dim wbtemporariosbruto workbook, wstemporariosativos worksheet, wsjaativos worksheet, wsaprendizesfit worksheet dim wbpresencesystem workbook, wstpcc worksheet  set wbthmacro = workbooks("training hours macro.xlsm") set wsregulares = wbthmacro.sheets("regulares") wsregulares.cells.clearcontents  set wbregularesbruto = workbooks.open(filename:="h:\bx-hr\bx-industrial relations\hr representatives\private\hrssc\brazil\training hours macro\regulares bruto.xls") if not wbregularesbruto nothing      set wssheet = wbregularesbruto.sheets("movimentacao")     wssheet.cells.copy wsregulares.range("a1")     set wssheet = wbregularesbruto.sheets("demitidos")     set wsregularesdemitidos = wbthmacro.sheets("regulares demitidos")     wssheet.cells.copy wsregularesdemitidos.range("a1")     wbregularesbruto.close false else     exit sub end if  set wbtemporariosbruto = workbooks.open(filename:="h:\bx-hr\bx-industrial relations\hr representatives\private\hrssc\brazil\training hours macro\temporarios bruto.xlsx") if not wbtemporariosbruto nothing      set wssheet = wbtemporariosbruto.sheets("temporarios ativos")     set wstempactivos = wbthmacro.sheets("temp activos")     wssheet.cells.copy wstempactivos.range("a1")     set wssheet = wbtemporariosbruto.sheets("ja ativos")     set wstempja = wbthmacro.sheets("temp ja")     wssheet.cells.copy wstempja.range("a1")     set wssheet = wbtemporariosbruto.sheets("aprendizes fit")     set wstempfit = wbthmacro.sheets("temp fit")     wssheet.cells.copy wstempfit.range("a1")     set wssheet = wbtemporariosbruto.sheets("demitidos")     set wstempdemitidos = wbthmacro.sheets("temp demitidos")     wssheet.cells.copy wstempdemitidos.range("a1")     wbtemporariosbruto.close false else     exit sub end if  set wbpresencesystem = workbooks.open(filename:="h:\bx-hr\bx-industrial relations\hr representatives\private\hrssc\brazil\training hours macro\presence system bruto.xls") if not wbpresencesystem nothing      'set wssheet = wstpcc.sheets("tpcc")     set wsps = wbthmacro.sheets("ps")     'wssheet.cells.copy wstempactivos.range("a1")      rows("1:1").select     selection.delete shift:=xlup     range("c1").select     activecell.formular1c1 = "cc"     columns("d:d").select     selection.insert shift:=xltoright     range("d1").select     activecell.formular1c1 = "mo"     range("a2").select     activecell.formular1c1 = "38697263859*"     columns("a:a").select     selection.replace what:="*", replacement:="", lookat:=xlpart, _                       searchorder:=xlbyrows, matchcase:=false, searchformat:=false, _                       replaceformat:=false     cells.select     selection         .horizontalalignment = xlgeneral         .verticalalignment = xlcenter         .orientation = 0         .addindent = false         .indentlevel = 0         .shrinktofit = false         .readingorder = xlcontext         .mergecells = false     end     selection         .horizontalalignment = xlcenter         .verticalalignment = xlcenter         .orientation = 0         .addindent = false         .indentlevel = 0         .shrinktofit = false         .readingorder = xlcontext         .mergecells = false     end     selection.rowheight = 15     range("a1").select     selection.autofilter      sheets("treimentosporcentrodecusto (5)").select     sheets("treimentosporcentrodecusto (5)").name = "tpcc"      set wssheet = wstpcc.sheets("tpcc")     set wsps = wbthmacro.sheets("ps")     wssheet.cells.copy wstempactivos.range("a1")     wbpresencesystem.close false else     exit sub end if  end sub 

here code macro in case:

option explicit sub traininghoursmacro()  dim wbthmacro workbook, wsregulares worksheet, wsregularesdemitidos worksheet, wstempactivos worksheet, wstempja worksheet, wstempfit worksheet, _ wstempdemitidos worksheet, wsps worksheet, wsresultados worksheet, wsdllist worksheet, wssheet worksheet dim wbregularesbruto workbook, wsmovimentacao worksheet, wsdemitidos worksheet dim wbtemporariosbruto workbook, wstemporariosativos worksheet, wsjaativos worksheet, wsaprendizesfit worksheet dim wbpresencesystem workbook, wstpcc worksheet dim wbflexutraininghours workbook, wshours worksheet, wsflexu worksheet dim rcell range  set wbthmacro = workbooks("training hours macro.xlsm") set wsregulares = wbthmacro.sheets("regulares") wsregulares.cells.clearcontents  set wbregularesbruto = workbooks.open(filename:="h:\bx-hr\bx-industrial relations\hr representatives\private\hrssc\brazil\training hours macro\regulares bruto.xls") if not wbregularesbruto nothing  set wssheet = wbregularesbruto.sheets("movimentacao")     wssheet.cells.copy wsregulares.range("a1")         set wssheet = wbregularesbruto.sheets("demitidos") set wsregularesdemitidos = wbthmacro.sheets("regulares demitidos")     wssheet.cells.copy wsregularesdemitidos.range("a1")         wbregularesbruto.close false else     exit sub             end if  set wbtemporariosbruto = workbooks.open(filename:="h:\bx-hr\bx-industrial relations\hr representatives\private\hrssc\brazil\training hours macro\temporarios bruto.xlsx") if not wbtemporariosbruto nothing  set wssheet = wbtemporariosbruto.sheets("temporarios ativos")     set wstempactivos = wbthmacro.sheets("temp activos")     wssheet.cells.copy wstempactivos.range("a1") set wssheet = wbtemporariosbruto.sheets("ja ativos")     set wstempja = wbthmacro.sheets("temp ja")     wssheet.cells.copy wstempja.range("a1") set wssheet = wbtemporariosbruto.sheets("aprendizes fit")     set wstempfit = wbthmacro.sheets("temp fit")     wssheet.cells.copy wstempfit.range("a1") set wssheet = wbtemporariosbruto.sheets("demitidos")     set wstempdemitidos = wbthmacro.sheets("temp demitidos")     wssheet.cells.copy wstempdemitidos.range("a1")         wbtemporariosbruto.close false else     exit sub             end if  set wbpresencesystem = workbooks.open(filename:="h:\bx-hr\bx-industrial relations\hr representatives\private\hrssc\brazil\training hours macro\presence system bruto.xls") if not wbpresencesystem nothing  set wsps = wbthmacro.sheets("ps")      rows("1:1").select     selection.delete shift:=xlup     range("c1").select     activecell.formular1c1 = "cc"     columns("d:d").select     selection.insert shift:=xltoright     range("d1").select     activecell.formular1c1 = "mo"     range("a2").select     activecell.formular1c1 = "38697263859 "         each rcell in range("a2:a" & range("a" & rows.count).end(3)(1).row)     rcell.value = left(rcell, len(rcell) - 1)     'rcell.value = trim(rcell) next rcell      cells.select     selection         .horizontalalignment = xlgeneral         .verticalalignment = xlcenter         .orientation = 0         .addindent = false         .indentlevel = 0         .shrinktofit = false         .readingorder = xlcontext         .mergecells = false     end     selection         .horizontalalignment = xlcenter         .verticalalignment = xlcenter         .orientation = 0         .addindent = false         .indentlevel = 0         .shrinktofit = false         .readingorder = xlcontext         .mergecells = false     end     selection.rowheight = 15     range("a1").select     selection.autofilter  each wssheet in activeworkbook.worksheets     if left(wssheet.name, 27) = "treimentosporcentrodecustro"     wssheet.activate     end if     activesheet.name = "tpcc"     exit next wssheet  set wssheet = wbpresencesystem.sheets("tpcc")     set wsps = wbthmacro.sheets("ps")     wssheet.cells.copy wsps.range("a1")     wbpresencesystem.close false else     exit sub             end if  set wbflexutraininghours = workbooks.open(filename:="h:\bx-hr\bx-industrial relations\hr representatives\private\hrssc\brazil\training hours macro\flex u training hours.xls") if not wbflexutraininghours nothing  each wssheet in activeworkbook.worksheets     if left(wssheet.name, 29) = "training_hours_12_37_24_pm 1 "     wssheet.activate     end if     activesheet.name = "hours"     exit next wssheet  set wssheet = wbflexutraininghours.sheets("hours")     set wsflexu = wbthmacro.sheets("flex u")     wssheet.cells.copy wsflexu.range("a1")         wbflexutraininghours.close false else     exit sub             end if  end sub 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -