excel vba - VB Copy command opens update values window -
i have following code
sub worksheetcopy() ' dimensions variables workbooks dim wbsource workbook dim wbdest workbook dim copyyear integer dim yearcount integer dim ws1 worksheet dim ws2 worksheet dim yeardate string application.screenupdating = false ' turns off notifications set wbsource = thisworkbook ' sets workbook source workbook set wbdest = workbooks.open("c:\users\u486474\desktop\lv 2 templates\hourslog.xlsx") ' sets destination workbook ' hard coded specific file location copyyear = 2015 ' sets first year copy data minus 1 year counter yearcount = 1 3 ' loop define number of years report copy ' loop runs 3 times 2016, 2017 , 2018 copyyear = copyyear + 1 ' increments per year yeardate = copyyear ' converts variable string use in named fields debug.print " copyyear " & copyyear & " yearcount " & yearcount & " yeardate " & yeardate ' testing set ws1 = wbsource.sheets(yeardate) ' sets source workbook / worksheet , year copied set ws2 = wbdest.sheets(yeardate) ' sets destination workbook / worksheet , year pasted ws1.cells.copy ws2.cells ' command copy source worksheet , paste destination worksheet next wbdest.close true 'saves , closes destination workbook application.screenupdating = true ' turns notifications on end sub what happens when gets copy command opens update values window. stops routine woking until cancel select window. other routine works fine. trying automate routine , not want user inputs.
secondly have been trying ti figure out how paste values. cells contain formulas. need values report. searching forums
ws1.range("a1:cz14400").copy ws2.range("a1:cz14400").pastespecial xlpasteformulas in place of copy command line
it did not work , out of memory error.
file large.. 32 meg
and appreciated.
thank you
Comments
Post a Comment