Excel VBA maxter data -


i used code copy cells master data. data in cell contains formulas. how can paste data in other sheet changing format of cell number.??

sub maxterdata()  sheets("sheet1").range("b2:e2").copy   dim lastrow long lastrow = range("a65536").end(xlup).row  sheets("summary info").activate cells(lastrow + 1, 1).pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks:=false, transpose:=false   end sub 

try this:

sub maxterdata()  dim lastrow long  sheets("summary info")     lastrow = .range("a" & rows.count).end(xlup).row     .cells(lastrow + 1, 1).resize(, 4).value = sheets("sheet1").range("b2:e2")     .cells(lastrow + 1, 1).resize(, 4).numberformat = "general" end  end sub 

try avoid using .select , .activate. of time not needed , slows done code.

also when wanting values assign values directly target.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -