excel - Copying and Pasting -
i got vba coding, however, though code compiles without hiccups, still fails it's intended purpose. essentially, merely test program created copy , paste information 1 workbook in specific cell.
sub copyopenitems() ' copyopenitems macro ' copy open items sheet. ' keyboard shortcut: ctrl+shift+o ' dim wbtarget workbook 'workbook data pasted dim wbthis workbook 'workbook data copied dim wstarget worksheet dim wsthis worksheet dim strname string 'name of source sheet/ target workbook 'set current active workbook (the source book) set wbthis = activeworkbook 'get active sheetname of book strname = activesheet.name 'open target workbook set wbtarget = workbooks.open("c:\users\administrator\desktop\excel testing\excel info testing 2.xlsx") 'set variable current worksheet set wsthis = activesheet 'set variable target worksheet set wstarget = wbtarget.worksheets(strname) wsthis.range("c6").select 'clear thing on clipboard maximize available memory application.cutcopymode = false 'copy range source book wsthis.range("c6").copy 'paste data on target book wstarget.range("e5").pastespecial 'clear thing on clipboard maximize available memory application.cutcopymode = false 'save target book wbtarget.save 'close workbook wbtarget.close 'clear memory set wbtarget = nothing set wbthis = nothing end sub
Comments
Post a Comment