excel - Copy values to new sheet after the last sheet and delete column b if empty -
i want copy values (not formulas) of last sheet of workbook run macro on (i won't know names of sheets or quantity of sheets) , delete b column if it's blank , name new wirksheet "games". have , it's not working =(. give me help?
sub arrumartabela() activesheet.copy cells.copy application.cutcopymode = false activesheet.name = "games" range("a1").pastespecial paste:=xlpastevalues application.screenupdating = false activesheet.name = "games" dim cl range each cl in range("$b$2:$b" & range("$b$65536").end(xlup).row) if cl = "" cl.entirecolumn.delete next cl range("c1").select selection.entirecolumn.insert , copyorigin:=xlformatfromleftorabove application.screenupdating = true end sub
will modification need?
sub arrumartabela() activesheet.copy 'this create new workbook , new sheet current activesheet .name = "games" 'change new sheets name .cells.copy 'copy cells .range("a1").pastespecial paste:=xlpastevalues 'paste values .screenupdating = false lastrow = .cells(.rows.count, "b").end(xlup).row 'last row? set cl = .range("b2:b" & lastrow).find("", lookat:=xlwhole) 'find blank cell in range if not cl nothing cl.entirecolumn.delete 'delete column if blank exists .range("c1").entirecolumn.insert 'insert new column belfore column c .screenupdating = true end end sub
Comments
Post a Comment