excel - VBA - Copy from Closed File paste to next available row on Summary Sheet -
this first post. forgive me if doing wrong here. glad correct mistakes. have found web site valuable baby in field of vba. please have patience me.
i super rookie in vba. learning go have spent lot of time on this. find bits , pieces of information on web have trouble in putting them together. have learned how make vba macro can select file , run other macros. using excel 2013. complete time sheet every week(sometimes more @ end of month) of hours work , projects work on. include on sheet when out , code reason. copy 3 sections summary sheet.
- cell d1. cell has date beside it. copy cell in first row.
- cells f3-l3 cells code put. copy second cell in first row.
- the next range of cells aret last cells data in columns f-l. these vary have different numbers of rows work orders each time in columns f-l. copy second row below corresponding cells in first. next file copy next available row in summary.
i copy data can figure vacation days, sick days, etc. know i'm asking alot extremely grateful help.
i'm giving example, still need modify...
option explicit 'forces programmer declare variables sub button_to_copy () 'link button or other action launchs sub dim range_to_copy range dim range_destination range dim sheet_data worksheet 'sheet pull data dim sheet_destination worksheet' summary sheet set sheet_data = thisworkbook.sheets("sheet1") 'you might have rename sheetname accordingly name. set sheet_destination = thisworkbook.sheets("summary") ' wild guess, correct summary sheet name set range_to_copy = sheet_data.range("d1") set range_destination = sheet_destination.range("a1") range_to_copy.copy range_destination 'this copies range b (basically a.copy b), changed variable names make easier... 'more code, copies 'you can simplify without variables this: 'sheets("sheet1").range("d1").copy sheets("summary).range("a1") <===== same above coding end sub
note never used activate or select, wich macro recorder badly use time, making bad habits starters.
also, referencing hard cell location "d1", code not dynamic, if add more data, sub have changed, use start maybe
Comments
Post a Comment