i'm working on existing excel file lots of macros , want copy , paste variable data 5 different sheets 5 other sheets without copying blank cells. made far , gives me runtime error 1004:
sub macro1() sheets("hulp_io").select range("a1").select range(selection, selection.end(xldown)).select selection.copy sheets("io").select range("b2").select activesheet.paste sheets("hulp_modbus_pmsx_lees_tags").select range("a1").select range(selection, selection.end(xldown)).select application.cutcopymode = false selection.copy sheets("modbus_lees_tags_pmsx").select range("a2").select activesheet.paste sheets("hulp_modbus_pmsx_schrijf_tags").select range("a1").select range(selection, selection.end(xldown)).select application.cutcopymode = false selection.copy sheets("modbus_schrijf_tags_pmsx").select range("a2").select activesheet.paste sheets("hulp_modbus_pakscan_lees_tags").select range("a1").select range(selection, selection.end(xldown)).select application.cutcopymode = false selection.copy sheets("modbus_lees_tags_packscan").select range("a2").select activesheet.paste sheets("hulp_modbus_pakscan_schrijf_tag").select range("a1").select range(selection, selection.end(xldown)).select application.cutcopymode = false selection.copy sheets("modbus_schrijf_tags_packscan").select range("a2").select activesheet.paste sheets("start").select end sub
here code largely reviewed, because .select command ressource-greedy , far more readable!
i don't know on line had error code important information, add if solve problem! ;)
here code :
sub nito_nascimento() dim wsfrom worksheet, _ wsto worksheet set wsfrom = sheets("hulp_io") set wsto = sheets("io") wsfrom.range("a1", wsfrom.range("a" & wsfrom.rows.count).end(xlup)).copy wsto.range("b2").pastespecial _ paste:=xlpastevalues, _ operation:=xlnone, _ skipblanks:=true, _ transpose:=false set wsfrom = sheets("hulp_modbus_pmsx_lees_tags") set wsto = sheets("modbus_lees_tags_pmsx") application.cutcopymode = false wsfrom.range("a1", wsfrom.range("a" & wsfrom.rows.count).end(xlup)).copy wsto.range("a2").pastespecial _ paste:=xlpastevalues, _ operation:=xlnone, _ skipblanks:=true, _ transpose:=false set wsfrom = sheets("hulp_modbus_pmsx_schrijf_tags") set wsto = sheets("modbus_schrijf_tags_pmsx") application.cutcopymode = false wsfrom.range("a1", wsfrom.range("a" & wsfrom.rows.count).end(xlup)).copy wsto.range("a2").pastespecial _ paste:=xlpastevalues, _ operation:=xlnone, _ skipblanks:=true, _ transpose:=false set wsfrom = sheets("hulp_modbus_pakscan_lees_tags") set wsto = sheets("modbus_lees_tags_packscan") application.cutcopymode = false wsfrom.range("a1", wsfrom.range("a" & wsfrom.rows.count).end(xlup)).copy wsto.range("a2").pastespecial _ paste:=xlpastevalues, _ operation:=xlnone, _ skipblanks:=true, _ transpose:=false set wsfrom = sheets("hulp_modbus_pakscan_schrijf_tag") set wsto = sheets("modbus_schrijf_tags_packscan") application.cutcopymode = false wsfrom.range("a1", wsfrom.range("a" & wsfrom.rows.count).end(xlup)).copy wsto.range("a2").pastespecial _ paste:=xlpastevalues, _ operation:=xlnone, _ skipblanks:=true, _ transpose:=false application.cutcopymode = false sheets("start").activate set wsfrom = nothing set wsto = nothing end sub
Comments
Post a Comment