SOLVED

Vba code help

%3CLINGO-SUB%20id%3D%22lingo-sub-1595558%22%20slang%3D%22en-US%22%3EVba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1595558%22%20slang%3D%22en-US%22%3EHi%2C%20I%E2%80%99ve%20been%20tasked%20with%20creating%20a%20parts%20spreadsheet%20in%20work%2C%20so%20for%20the%20past%20six%20weeks%20I%20have%20itemised%20over%202000%20parts.%20After%20completing%20the%20data%20input%20I%E2%80%99ve%20set%20about%20making%20it%20more%20user%20friendly%2C%20but%20have%20been%20beaten%20by%20my%20limits%20on%20vba.%20I%20have%20manage%20to%203%20vba%20codes%20to%20preform%20different%20tasks%20across%204%20mains%20worksheets%20(parts%20list%2C%20re-order%20report%2C%20parts%20movement%2C%20catalogue).%20I%E2%80%99ve%20made%20over%204000%20function%20buttons%20to%20preform%202%20different%20tasks.%202000%20increase%20parts%20list%20cells%20(Q1%3AQ2000)%20by%20%2B1%20if.%20clicked.%20The%20other%202000%20buttons%20decrease%20the%20same%20cells%20by%20-1%20if%20clicked.%20My%20third%20code%20is%20also%20a%20button%20which%20runs%20a%20re%20order%20report%20by%20searching%20for%20the%20word%20YES%20in%20cells%20(R1%3AR2000)%20then%20copying%20the%20rows%20and%20populating%20them%20into%20the%20reorder%20sheet.%20But%20while%20running%20my%20spreadsheet%20within%20my%20maintenance%20team%20I%20encountered%20a%20problem%2C%20I%20have%20no%20record%20of%20parts%20movement.%20For%20the%20past%20week%20I%E2%80%99ve%20tried%20and%20tried%20and%20searched%20the%20internet%20but%20have%20came%20up%20short%2C%20in%20my%20search%20a%20and%20code%20building.%20I%20need%20a%20code%20to%20Automatically%20(no%20buttons)%20read%20cells(Q1%3AQ2000)%20for%20any%20change%20(these%20cells%20are%20increased%20and%20decreased%20by%201%20with%20each%20click%20of%20the%202000%20add%20buttons%20and%202000%20remove%20buttons.%20The%20code%20then%20needs%20to%20copy%20each%20row%20in%20which%20the%20Q%20cell%20has%20increased%20or%20decreased%20(cells%20A%20to%20L)%20and%20paste%20them%20into%20parts%20movement%20sheet%20starting%20in%20row%205%20and%20pasting%20into%20cells%20(%20A%20to%20L)%20.%20The%20code%20also%20needs%20to%20allow%20the%20pasted%20rows%20to%20stay%20and%20to%20just%20create%20another%20row%20if%20the%20same%20part%20has%20been%20increased%20or%20decreased.%20I%20also%20need%20the%20pasted%20rows%20in%20parts%20movement%20sheet%20to%20be%20Timestamped%20this%20would%20allow%20a%20history%20for%20both%20used%20and%20restocked%20parts.%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1595558%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1595963%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1595963%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F762853%22%20target%3D%22_blank%22%3E%40StevieGis01%3C%2FA%3E%26nbsp%3BMy%20first%20thought%20is%20that%20a%20spreadsheet%20with%204000%20(!)%20buttons%20is%20overwhelming.%20Especially%20when%20you%20are%20talking%20about%20%22only%22%202000%20parts%20to%20track.%20There%20must%20be%20a%20simpler%20way%2C%20although%20I%20do%20not%20know%20how%20you%20have%20structured%20your%20data%20or%20what%20exactly%20you%20are%20asked%20to%20deliver.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20probable%20start%20having%20a%20parts%20table%20and%20a%20transactions%20table%20and%20link%20them%20together%20using%20one%20of%20Excel's%20LOOKUP%20functions%2C%20Pivot%20Tables%20and%2For%20Power%20Query%20%2F%20Power%20Pivot%2C%20and%20do%20the%20reporting%20(plus%20and%20minus%20and%20history)%20from%20there.%20But%20again%2C%20I%20have%20no%20idea%20about%20your%20real%20life%20situation.%20So%2C%20perhaps%20my%20thoughts%20are%20completely%20out%20of%20line.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1598574%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1598574%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3BThankyou%20for%20your%20replay%2C%20I%20forgot%20to%20mention%20that%20im%20not%20very%20good%20with%20computers%20I'm%20just%20an%20electrician.%20What%20you%20said%20made%20me%20rethink%20my%20parts.%20I've%20now%20drastically%20reduced%20my%20parts%20list%20down%20to%20a%20maximum%20of%20200%20across%2012%20different%20spreadsheets%20(1%20for%20each%20of%20our%20machines).%26nbsp%3B%3C%2FP%3E%3CP%3EAll%20my%20machine%20spreadsheets%20are%20set%20out%20the%20same%20way%2C%20as%20follows%3C%2FP%3E%3CP%3E1.%20Parts%20List%20(Sheet1)%3C%2FP%3E%3CP%3E2.%20Reorder%20Parts%20Report%20(Sheet2)%3C%2FP%3E%3CP%3E3.%20Parts%20Removed%20(Sheet3)%3C%2FP%3E%3CP%3E4.%20Parts%20Added(Sheet4)%3C%2FP%3E%3CP%3EThe%20parts%20list%20(Sheet1)%20has%20a%20max%20of%20200%20rows%2C%20each%20row%20uses%20cells%20(A%3AS)%2C%3C%2FP%3E%3CP%3EOn%20sheet1%20I've%20made%20a%20vba%20button%20to%20run%20a%20reorder%20parts%20report.%20When%20clicked%20the%20code%20unlocks%20sheet1%2C%20clears%20all%20cells%20in%20sheet2%2C%20looks%20for%26nbsp%3B%22YES%22%20within%20cells%20(R%3AR200)%2C%20it%20then%20copies%20the%20rows%20cells(A%3AL%2CQ%2CR%2CS)%20from%20sheet1%2C%20pastes%20the%20rows%20onto%20the%20parts%20reorder%20report%20sheet%20(Sheet2)%2C%20then%20locks%20sheet1%20again.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWithin%20all%20sheet1%20cells%20(o)%20I've%20made%20a%20vba%20button%20to%20unlock%20sheet1%2C%20then%20reduce%20the%20value%20in%20cell%20(Q)%20by%201%2C%20then%20copy%20cells%20(A%3AL%2CQ%2CR%2CS)%20of%20the%20same%20row%20and%20paste%20them%20into%20Sheet3%20in%20the%20next%20available%20row%2C%20then%20return%20back%20to%20sheet1%20cell%20(A)%20of%20the%20same%20row%20which%20had%20been%20reduced%2C%20and%20lock%20sheet1%20again.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWithin%20all%20sheet1%20cells%20(p)%20I've%20made%20a%20vba%20button%20to%20unlock%20sheet1%2C%20then%20increase%20the%20value%20in%20cell%20(Q)%20by%201%2C%20then%20copy%20cells%20(A%3AL%2CQ%2CR%2CS)%20of%20the%20same%20row%20and%20paste%20them%20into%20Sheet4%20in%20the%20next%20available%20row%2C%20then%20return%20back%20to%20sheet1%20cell%20(A)%20of%20the%20same%20row%20which%20had%20been%20reduced%2C%20and%20lock%20sheet1%20again.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20Possible%20could%20you%20help%20me%20with%20tidying%20up%20my%20already%20made%20vba%20and%20give%20and%20also%20help%20me%20to%20create%20a%20time%20stamp%20in%20cell(o)%20for%20both%20sheet3%20and%20sheet4%20for%20each%20row%20that%20pastes%20to%20give%20me%20some%20sort%20of%20parts%20tracking.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20vba%20codes%20are%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPublic%20Sub%20RunReOrderReport()%3C%2FP%3E%3CP%3E'%3C%2FP%3E%3CP%3E'%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Clear%20Re%20Order%20Sheet%20First%3C%2FP%3E%3CP%3E'%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Run%20Re%20Order%20Count%3C%2FP%3E%3CP%3E'%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Based%20On%20Re%20Order%20Colum%20%22YES%22%20OR%20%22%20NO%22%3C%2FP%3E%3CP%3E'%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Copy%20Row%20and%20Paste%20on%20to%20Re%20order%20Sheet%3C%2FP%3E%3CP%3E'%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Continue%20Though%20Sheet%20Until%20Complete%3C%2FP%3E%3CP%3E'%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20End%3C%2FP%3E%3CP%3E'%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20ThisWorkbook.Worksheets(%22Parts%20List%22).Unprotect%20(%22Password%22)%20'%20Unlock%20Sheet%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Sheets(%22Re%20Order%20Parts%20Report%22).Cells.Clear%20'Clear%20Re%20Order%20Sheet%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Dim%20c%20As%20Range%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Dim%20j%20As%20Integer%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Dim%20Source%20As%20Worksheet%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Dim%20Target%20As%20Worksheet%3C%2FP%3E%3CP%3E'%3C%2FP%3E%3CP%3E'%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BSource%20%22Parts%20List%22%20(%22Sheet1%22)%3C%2FP%3E%3CP%3E'%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Target%20%22Re%20Order%20Parts%20Report%22%20(%22Sheet2%22)%3C%2FP%3E%3CP%3E'%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20j%20%3D%202%26nbsp%3B%26nbsp%3B%20'Start%20Copying%20To%20Row%202%20In%20Target%20Sheet%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Set%20Target%20%3D%20ThisWorkbook.Worksheets(%22Re%20Order%20Parts%20Report%22)%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E'%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3BFor%20Each%20c%20In%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Set%20Source%20%3D%20ThisWorkbook.Worksheets(%22Parts%20List%22)%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20For%20Each%20c%20In%20Source.Range(%22G1%3AG1000%22)%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E'%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Do%201000%20Rows%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20If%20c%20%3D%20%22YES%22%20Then%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E'%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20(%22Shee1%22)%2CRange.Value%20%3D%20%22YES%22%20%3D%20TRUE%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20'%20Source%20%2C%20ThisWorkbook.Worksheets(%22Sheet1%22).Rows.c%2C%20Copy.Row%20%3D%202%2C%20Copy.Target.Rows(j)%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Source.Rows(c.Row).Copy%20Target.Rows(j)%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20j%20%3D%20j%20%2B%201%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20End%20If%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Next%20c%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20ThisWorkbook.Worksheets(%22Parts%20List%22).Protect%20(%22Password%22)%3C%2FP%3E%3CP%3EEnd%20Sub%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPublic%20Sub%20MinusOnePartClickButtonTest()%3CBR%20%2F%3E'%3CBR%20%2F%3E'%20PartsRemoved%20Macro%3CBR%20%2F%3E'%20if%20-1%20button%20clicked%20copy%20stock%20and%20row%20to%20parts%20removed%20sheet%3CBR%20%2F%3E'%3CBR%20%2F%3EThisWorkbook.Worksheets(%22Parts%20List%22).Unprotect%20(%22Password%22)%20'%20Unlock%20Sheet%3CBR%20%2F%3ESheets(%22Parts%20List%22).Select%3CBR%20%2F%3ERange(%22F8%22).Value%20%3D%20Range(%22F8%22).Value%20-%201%3CBR%20%2F%3ERange(%22A8%2CF8%22).Select%3CBR%20%2F%3ERange(%22F8%22).Activate%3CBR%20%2F%3ESelection.Copy%3CBR%20%2F%3ESheets(%22Parts%20Removed%22).Select%3CBR%20%2F%3ERange(%22A%22%20%26amp%3B%20Rows.Count).End(xlUp).Offset(1).Select%3CBR%20%2F%3EActiveSheet.Paste%3CBR%20%2F%3EActiveSheet.Paste%3CBR%20%2F%3ESheets(%22Parts%20List%22).Select%3CBR%20%2F%3ERange(%22A8%22).Select%3CBR%20%2F%3EApplication.CutCopyMode%20%3D%20False%3CBR%20%2F%3ERange(%22A8%22).Select%3CBR%20%2F%3EThisWorkbook.Worksheets(%22Parts%20List%22).Protect%20(%22Password%22)%20'%20Lock%20Sheet%3CBR%20%2F%3EEnd%20Sub%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPublic%20Sub%20AddOnePartClickButtonTest()%3CBR%20%2F%3E'%3CBR%20%2F%3E'%20PartsRemoved%20Macro%3CBR%20%2F%3E'%20if%20-1%20button%20clicked%20copy%20stock%20and%20row%20to%20parts%20removed%20sheet%3CBR%20%2F%3E'%3CBR%20%2F%3EThisWorkbook.Worksheets(%22Parts%20List%22).Unprotect%20(%22Password%22)%20'%20Unlock%20Sheet%3CBR%20%2F%3ESheets(%22Parts%20List%22).Select%3CBR%20%2F%3ERange(%22F8%22).Value%20%3D%20Range(%22F8%22).Value%20%2B%201%3CBR%20%2F%3ERange(%22A8%2CF8%22).Select%3CBR%20%2F%3ERange(%22F8%22).Activate%3CBR%20%2F%3ESelection.Copy%3CBR%20%2F%3ESheets(%22Parts%20Added%22).Select%3CBR%20%2F%3ERange(%22A%22%20%26amp%3B%20Rows.Count).End(xlUp).Offset(1).Select%3CBR%20%2F%3EActiveSheet.Paste%3CBR%20%2F%3EActiveSheet.Paste%3CBR%20%2F%3ESheets(%22Parts%20List%22).Select%3CBR%20%2F%3ERange(%22A8%22).Select%3CBR%20%2F%3EApplication.CutCopyMode%20%3D%20False%3CBR%20%2F%3ERange(%22A8%22).Select%3CBR%20%2F%3EThisWorkbook.Worksheets(%22Parts%20List%22).Protect%20(%22Password%22)%3CBR%20%2F%3EEnd%20Sub%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20Hope%20this%20makes%20sense%26nbsp%3B%20as%20I%20couldn't%20figure%20out%20how%20to%20make%20my%20vba%20look%20the%20same%20as%20everybody%20else's%20post's%20on%20here%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20again%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1598805%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1598805%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F762853%22%20target%3D%22_blank%22%3E%40StevieGis01%3C%2FA%3E%26nbsp%3BHi%20there!%20Thanks%20for%20sharing.%20Quite%20a%20bit%20of%20extra%20information%20to%20digest.%20Am%20preparing%20for%20a%20small%20road%20trip%20just%20now%20and%20don't%20know%20how%20much%20time%20I'll%20have%20to%20look%20into%20this%20over%20the%20next%20few%20days.%20In%20the%20meantime%2C%20perhaps%20someone%20else%20out%20here%20can%20have%20a%20look%20at%20it.%20In%20order%20to%20increase%20your%20chances%20for%20a%20response%20you%20can%20perhaps%20upload%20one%20of%20your%20files%20(for%20one%20machine).%20Replace%20any%20confidential%20information%20with%20some%20faked%20data%20though.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1598823%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1598823%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F762853%22%20target%3D%22_blank%22%3E%40StevieGis01%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECleaning%20up%20the%20code%20is%20often%20a%20matter%20of%20removing%20%22select%22%20and%20%22activate%22%20and%20joining%20whatever%20was%20selected%2Factivated%20with%20the%20action.%20Instead%20of%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERange(%22A1%22).Select%3C%2FP%3E%3CP%3ESelection.Value%20%3D%2010%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eit%20can%20be%20shortened%20to%20just%3C%2FP%3E%3CP%3ERange(%22A1%22).Value%20%3D%2010%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJust%20my%20two%20cents%2C%20but%20since%20these%20two%20procedures%20have%20a%20lot%20of%20overlap%2C%20you%20could%20set%20up%20a%20third%20procedure%20to%20do%20the%20work%20and%20just%20pass%20it%20the%20value%20by%20which%20to%20increase%2Fdecrease%20the%20cell.%20And%2C%20if%20you%20had%20cells%20other%20than%20F8%20that%20this%20process%20worked%20on%2C%20you%20could%20pass%20it%20the%20applicable%20cell(s)%20on%20the%20Parts%20List%20worksheet.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOr%2C%20you%20could%20have%20the%20user%20select%20the%20cells%20they%20want%20to%20increment%2Fdecrement%20and%20have%20the%20macro%20work%20on%20whatever%20range%20the%20user%20has%20selected%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3EPublic%20Sub%20MinusOnePartClickButtonTest()%0A%20%20%20%20%20ChangePartCount%20-1%0AEnd%20Sub%0A%0APublic%20Sub%20AddOnePartClickButtonTest()%0A%20%20%20%20%20ChangePartCount%201%0AEnd%20Sub%0A%0APublic%20Sub%20ChangePartCount(changeValue%20As%20Integer)%0A%20%20%20%20%20Dim%20destWkSht%20As%20Worksheet%0A%20%20%20%20%20Dim%20destCell%20As%20Range%0A%20%20%20%20%20Dim%20timeStampCell%20As%20Range%0A%20%20%20%20%20%0A%20%20%20%20%20%0A%20%20%20%20%20On%20Error%20GoTo%20ErrHandler%0A%20%20%20%20%20%0A%20%20%20%20%20%0A%20%20%20%20%20If%20changeValue%20%26lt%3B%200%20Then%0A%20%20%20%20%20%20%20%20%20%20Set%20destWkSht%20%3D%20Sheets(%22Parts%20Removed%22)%0A%20%20%20%20%20ElseIf%20changeValue%20%26gt%3B%200%20Then%0A%20%20%20%20%20%20%20%20%20%20Set%20destWkSht%20%3D%20Sheets(%22Parts%20Added%22)%0A%20%20%20%20%20Else%0A%20%20%20%20%20%20%20%20%20%20Exit%20Sub%0A%20%20%20%20%20End%20If%0A%20%20%20%20%20%0A%20%20%20%20%20%0A%20%20%20%20%20With%20destWkSht%0A%20%20%20%20%20%20%20%20%20%20Set%20destCell%20%3D%20.Range(%22A%22%20%26amp%3B%20.Rows.Count).End(xlUp).Offset(1)%0A%20%20%20%20%20%20%20%20%20%20Set%20timeStampCell%20%3D%20Intersect(.Range(%22O%3AO%22).EntireColumn%2C%20destCell.EntireRow)%0A%20%20%20%20%20End%20With%0A%0A%0A%20%20%20%20%20With%20ThisWorkbook.Worksheets(%22Parts%20List%22)%0A%20%20%20%20%20%20%20%20%20%20.Unprotect%20(%22Password%22)%20'%20Unlock%20Sheet%0A%20%20%20%20%20%20%20%20%20%20.Range(%22F8%22).Value%20%3D%20.Range(%22F8%22).Value%20%2B%20changeValue%0A%20%20%20%20%20%20%20%20%20%20.Range(%22A8%2CF8%22).Copy%20destCell%0A%20%20%20%20%20%20%20%20%20%20.Protect%20(%22Password%22)%20'%20Lock%20Sheet%0A%20%20%20%20%20End%20With%0A%20%20%20%20%20%0A%20%20%20%20%20timeStampCell.Value%20%3D%20Now%0A%20%20%20%20%20%0A%20%20%20%20%20Application.CutCopyMode%20%3D%20False%0A%0A%0AExitProc%3A%0A%20%20%20%20%20Set%20destCell%20%3D%20Nothing%0A%20%20%20%20%20Set%20destWkSht%20%3D%20Nothing%0A%20%20%20%20%20Exit%20Sub%0A%20%20%20%20%20%0AErrHandler%3A%0A%20%20%20%20%20MsgBox%20%22Error%20%22%20%26amp%3B%20Err.Number%20%26amp%3B%20%22%3A%20%22%20%26amp%3B%20Err.Description%0A%20%20%20%20%20Resume%20ExitProc%0A%20%20%20%20%20%0AEnd%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1601024%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1601024%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F675152%22%20target%3D%22_blank%22%3E%40JMB17%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThankyou%20for%20your%20very%20swift%20reply%2C%20I've%20no%20doubt%20that%20your%20code%20is%20correct%20and%20I%20sound%20exactly%20what%20I%20was%20looking%20for.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%20I'm%20sure%20I%20must%20be%20doing%20something%20wrong%20because%20I%20can't%20get%20the%20code%20to%20run%20on%20my%20system.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAfter%20reading%20your%20reply%20and%20looking%20through%20your%20code%20I'd%20realised%20I%20send%20you%20a%20mixture%20of%202%20different%20spreadsheet%20details.%20I%20made%20the%20real%20spreadsheet%20but%20because%20I%20know%20very%20little%20about%20VBA%20I%20made%20a%20very%20small%20test%20spreadsheet%20to%20play%20around%20with%20so%20that%20I%20wouldn't%20mess%20up%20all%20my%20hard%20work%20and%20the%20cell%20destinations%20where%20from%20the%20test%20spreadsheet%20with%20the%20correct%20sheet%20names%20from%20the%20main%20spreadsheet.%20So%20I've%20included%20a%20copy%20of%20both%20the%20main%20spreadsheet%20(with%20any%20sensitive%20details%20removed)%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%20could%20you%20advise%20me%20on%3C%2FP%3E%3CP%3EWithin%20my%20VBA%20(Sheet1.RunPartsReorderReport)%3C%2FP%3E%3CP%3E1.%20help%20me%20to%20only%20clear%20from%20row%202%20downwards%20in%20my%20Run%20Reorder%20Parts%20Report%20(is%20clears%20the%20previous%20report%20before%20pasting%20the%20next)%3C%2FP%3E%3CP%3E2.%20How%20to%20only%20copy%20cells%20(A%3AL%2CQ%2CR%2CS)%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYour%20code%20is%20called%20(Sheet1.PartsInventoryPartTracker)%3C%2FP%3E%3CP%3EIt%20runs%20about%2080%2F90%25%20of%20the%20code%20then%20stops%20at%20the%20line%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%20MsgBox%20%22Error%20%22%20%26amp%3B%20Err.Number%20%26amp%3B%20%22%3A%20%22%20%26amp%3B%20Err.Description%3C%2FP%3E%3CP%3EI%20changed%20the%20Value%20Range%20From%20(%22F8%22)%20To%20(%22Q4%3AQ250%22)%26nbsp%3B%20and%20the%20copy%20Range%20from(%22A8%2CF8%22)%20To%20(%22A%3AL%2CQ%2CR%2CS%22)%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BI%20hope%20this%20isn't%20the%20problem%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1602935%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1602935%22%20slang%3D%22en-US%22%3EI'll%20take%20a%20look%20at%20it.%20But%2C%20it%20may%20have%20to%20wait%20until%20this%20weekend.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1603207%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1603207%22%20slang%3D%22en-US%22%3ENo%20problem%2C%20thanks%20for%20all%20your%20help%2C%20I%20viewed%20the%20download%20I%20sent%20you%20and%20my%20-1%26amp%3B%2B1%20buttons%20don%E2%80%99t%20work%20because%20I%20had%20the%20running%20when%20the%20original%20workbook%20was%20opened%2C%20but%20the%20codes%20for%20them%20are%20in%20the%20viewer%2C%3CBR%20%2F%3EThanks%20again%20you%20great%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1604573%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1604573%22%20slang%3D%22en-US%22%3EThe%20range%20reference%20(%22A8%2CF8%22)%20will%20work%2C%20but%20(%22A%3AL%2CQ%2CR%2CS%22)%20will%20not%20(no%20worries%2C%20we%20can%20fix%20it).%3CBR%20%2F%3E%3CBR%20%2F%3EI%20see%20that%20you%20have%20increment%2Fdecrement%20buttons%20in%20row%205%2C%20columns%20O%20and%20P.%20Are%20these%20buttons%20dedicated%20to%20row%205%20(i.e.%20-%20in%20your%20master%20version%2C%20do%20you%20have%20buttons%20for%20each%20row%20that%20increment%2Fdecrement%20the%20current%20stock%20level%20only%20for%20the%20item%20in%20that%20specific%20row)%3F%20I%20guessing%20that%20is%20the%20case%20based%20on%20your%20original%20post%20regarding%20having%204k%20buttons%20for%202k%20parts.%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20so%2C%20I%20would%20agree%20with%20Riny%20that%20seems%20pretty%20overwhelming.%20Particularly%20when%20you%20consider%20making%20updates%20(adding%20parts%20or%20removing%20discontinued%20parts)%2C%20as%20each%20button%20is%20hardcoded%20to%20a%20specific%20row%20(so%2C%20if%20you%20insert%2Fdelete%20rows%2C%20you%20have%20to%20update%20the%20vba%20code%20for%20all%20of%20the%20cells%20that%20got%20moved%20up%2Fdown%20and%20delete%2Fadd%20buttons%20and%20their%20respective%20vba%20code).%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20you%20are%20open%20to%20suggestions%2C%20I%20would%20just%20have%202%20buttons%20(increment%2Fdecrement)%20above%20the%20column%20that%20change%20the%20stock%20quantity%20in%20the%20same%20row%20as%20the%20active%20cell.%20So%2C%20the%20user%20selects%20the%20row%20they%20want%20to%20change%2C%20then%20clicks%20the%20button%2C%20and%20the%20stock%20quantity%20changes%20in%20column%20Q%20of%20that%20same%20row.%20Then%20you%20are%20free%20to%20update%20your%20table%20w%2Fo%20having%20to%20update%20any%20of%20your%20increment%2Fdecrement%20code.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1604919%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1604919%22%20slang%3D%22en-US%22%3EYes%20that%E2%80%99s%20correct%2C%20I%E2%80%99ve%202%20buttons%20in%20every%20row%20that%20control%20the%20stock%20level%20cell%20then%20copy%20the%20row%20to%20the%20appropriate%20sheet%20ie.%20-1%20button%20go%20to%20parts%20removed%20sheet%2C%20and%20%2B1%20button%20go%20to%20parts%20added.%20It%20was%20a%20nightmare%20creating%20all%20the%20buttons%2C%20but%20that%E2%80%99s%20all%20I%20knew%20at%20the%20time.%3CBR%20%2F%3E%3CBR%20%2F%3EYour%20suggestion%20sounds%20perfect%2C%20but%20I%20wouldn%E2%80%99t%20even%20know%20where%20to%20start%2C%20would%20it%20be%20able%20when%20the%20cell%20is%20selected%20and%20the%20correct%20button%20clicked%20will%20the%20stock%20level%20change%20up%20or%20down%20depending%20on%20which%20button%20is%20pressed.%20Then%20after%20the%20level%20changes%20the%20row%20is%20copied%20the%20to%20appropriate%20sheet%20and%20time%20stamp%20the%20new%20row%20in%20the%20new%20sheet%20also%3F%20If%20all%20that%20is%20possible%20great%2C%20will%20this%20code%20still%20allow%20the%20run%20parts%20reorder%20report%20to%20work%2C%3CBR%20%2F%3E%3CBR%20%2F%3EThis%20sound%20like%20a%20lot%20of%20work%20for%20yourself%20on%20my%20behalf.%3CBR%20%2F%3E%3CBR%20%2F%3EAny%20help%20any%20greatly%20appreciated%2C%20it%E2%80%99s%20nice%20to%20be%20able%20to%20speak%20with%20Vba%20guru%2C%20my%20google%20searches%20only%20throw%20back%20the%20same%20things%20but%20described%20differently.%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%20again%20for%20all%20you%20help%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1606927%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1606927%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F762853%22%20target%3D%22_blank%22%3E%40StevieGis01%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESee%20if%20the%20attached%20workbook%20does%20what%20you%20are%20looking%20to%20do.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20named%20the%20cells%20in%20the%20last%20row%20of%20the%20table%20header.%20Instead%20of%20referring%20to%20a%20range%20by%20it's%20address%2C%20Range(%22Q4%22)%2C%20you%20can%20refer%20to%20it%20also%20by%20it's%20name%20(if%20it%20is%20named)%2C%20such%20as%20Range(%22Current_Stock%22)%20if%20cell%20Q4%20is%20named%20%22Current_Stock%22.%20The%20advantage%20is%20that%20if%20you%20modify%20your%20table%20(insert%20rows%2Fcolumns%20or%20cut%2Fpaste%20columns%20to%20they%20are%20in%20a%20different%20order)%2C%20your%20code%20can%20still%20find%20the%20named%20range%20whereas%20Range(%22Q4%22)%20will%20always%20refer%20to%20Q4%20(it%20doesn't%20realize%20Q4%20was%20moved%20because%20you%20inserted%2Fdeleted%20a%20row%2Fcolumn%20above%20or%20to%20the%20left%20of%20it).%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20also%20set%20up%20some%20constants%20in%20the%20code%20module%20that%20refer%20to%20the%20names%20of%20the%20header%20cells.%20So%2C%20if%20you%20change%20the%20names%20of%20the%20cells%2C%20you%20only%20have%20to%20update%20the%20constants%20that%20refer%20to%20them.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20added%20two%20forms%20buttons%2C%20which%20are%20named%20%22DecrementButton%22%20and%20%22IncrementButton%22)%20at%20the%20top%20of%20the%20current%20stock%20column.%20Both%20of%20these%20buttons%20attach%20to%20the%20macro%20%22ChangeStockButton_Click.%22%20The%20macro%20will%20check%20the%20name%20of%20the%20button%20that%20called%20it%20and%20increment%2Fdecrement%20the%20current%20stock%20in%20the%20same%20row%20as%20the%20active%20cell%20(you%20don't%20have%20to%20actually%20be%20in%20column%20Q%2C%20just%20on%20the%20same%20row).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThen%2C%20%22ChangeStockButton_Click%22%20will%20call%20%22CopyInvChange%2C%22%20which%20will%20copy%20the%20row%20of%20the%20item%20that%20was%20changed%20(excluding%20the%20min%2C%20initial%2C%20removed%2C%20and%20added%20fields)%20to%20the%20%22Parts%20Added%22%20or%20%22Parts%20Removed%22%20worksheets.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENote%20that%20worksheets%20actually%20have%20two%20names%20-%20tab%20name%20and%20code%20name.%20If%20you%20look%20at%20the%20worksheets%20listed%20in%20vba's%20project%20explorer%20window%20(view%5Cproject%20explorer)%2C%20the%20code%20name%20is%20the%20first%20name%20listed%20and%20the%20tab%20name%20is%20in%20parentheses.%20Instead%20of%20Worksheets(%22Parts%20List%22).Range(%22A1%22)%2C%20you%20could%20use%20Sheet1.Range(%22A1%22).%20That%20way%2C%20when%20users%20change%20the%20worksheet%20tab%20name%2C%20your%20code%20is%20not%20affected.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EExcel%20has%20quite%20a%20few%20tools%20for%20referring%20or%20navigating%20worksheet%20ranges.%20As%20much%20as%20possible%2C%20I%20try%20to%20avoid%20referring%20to%20ranges%20by%20their%20actual%20cell%20address%20so%20your%20macros%20are%20more%20flexible%20to%20changes%20made%20to%20the%20worksheet.%20These%20are%20a%20few%20that%20I%20used%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECurrentRegion%20-%20refers%20to%20a%20region%2C%20such%20as%20a%20table.%20In%20this%20file%2C%20refers%20to%20A1%3AS209%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUsedRange%20-%20refers%20to%20a%20worksheets%20%22used%20range.%22%20Instead%20of%20looping%20through%20all%20of%20the%20cells%20in%20the%20entire%20column%2C%20you%20can%20limit%20your%20search%20to%20the%20used%20range%20(no%20point%20in%20checking%20all%20of%20the%20empty%20cells%20in%20the%20unused%20range).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIntersect%20-%20returns%20the%20range%2Fcells%20in%20common%26nbsp%3B%20between%20two%20other%20ranges.%20Intersect(cell1.entirerow%2C%20cell2.entirecolumn)%20is%20one%20way%20to%20find%20the%20cell%20on%20the%20same%20row%2C%20but%20in%20another%20column.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUnion%20-%20merges%20two%20or%20more%20ranges%20together%20(not%20on%20the%20worksheet%20itself%2C%20but%20your%20vba%20range%20variable).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1606961%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1606961%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F762853%22%20target%3D%22_blank%22%3E%40StevieGis01%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETake%20a%20look%20at%20the%20file%20and%20see%20if%20that%20is%20what%20you%20have%20in%20mind.%20I%20added%20a%20worksheet%20with%20comments%20to%20provide%20some%20additional%20explanation%20of%20what%20I%20did.%20Hopefully%2C%20it%20makes%20sense.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EExcel%20has%20quite%20a%20few%20ways%20to%20refer%20to%20worksheet%20ranges%2C%20instead%20of%20using%20their%20cell%20address%2C%20that%20can%20help%20make%20the%20vba%20procedures%20less%20susceptible%20to%20breaking%20because%20a%20user%20(or%20you)%20moved%20things%20around%20(like%20cut%2Fpaste%20the%20table%20fields%20because%20you%20want%20them%20to%20appear%20in%20a%20different%20order%2C%20or%20inserting%20rows%20above%20your%20header%20row%2C%20or%20deleting%20some%20rows%2Fcolumns%20-%20depending%20on%20what's%20deleted).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1609044%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1609044%22%20slang%3D%22en-US%22%3EHi%3CBR%20%2F%3EYes%20everything%20that%20you%E2%80%99ve%2C%20done%20is%20exactly%20what%20I%20was%20hoping%20to%20achieve%20when%20I%20started%20out%2C%20and%20it%20works%20flawlessly%20on%20your%20file.%3CBR%20%2F%3EI%E2%80%99ve%20been%20trying%20from%20when%20you%20first%20sent%20the%20updated%20version%20to%20get%20it%20to%20work%20on%20the%20original%20which%20is%20on%20my%20company%E2%80%99s%20internal%20network%20(visible%20to%20everyone%20when%20they%20log%20in)%20but%20I%20can%E2%80%99t%20get%20it%20to%20work%2Frun.%20The%20only%20Vba%20code%20I%E2%80%99ve%20got%20on%20the%20original%20file%20is%20your%20Vba%20and%20it%E2%80%99s%20on%20sheet1%20just%20like%20your%20file.%20I%20started%20by%20firstly%20deleting%20everything%20to%20do%20with%20Vba%20from%20the%20original.%20After%20copying%20and%20pasting%20the%20new%20header%20names%20and%20layout%20from%20your%20to%20the%20original%20(%20so%20they%20now%20look%20identical)%2C%20I%20then%20copied%20and%20pasted%20the%20first%202%20rows%20from%20yours%20to%20the%20original%20that%20then%20gave%20me%20the%20buttons%20and%20title%2C%20I%20then%20opened%20Visual%20Basic%20and%20made%20sure%20that%20there%20was%20no%20modules%20or%20anything%20that%20shouldn%E2%80%99t%20be%20there%20then%20is%20pasted%20your%20code%20to%20sheet1%20of%20the%20Visual%20Basic.%20So%20now%20when%20I%E2%80%99ve%20got%20your%20version%20open%20on%20my%20laptop%20ant%20the%20original%20open%20on%20my%20work%20computer%20the%20only%20difference%20is%20that%20the%20original%20has%20a%20further%2016%20sheets%20(%20a%20picture%20catalogue%20Of%20all%20the%20parts)%20but%20these%20sheets%20are%20not%20nothing%20to%20do%20with%20the%20Vba%20code%20so%20should%20have%20no%20bearing%20on%20the%20outcome%20of%20any%20of%20the%20Vba%20code%20running%20(%20or%20so%20I%20think).%3CBR%20%2F%3EIf%20I%20open%20design%20mode%2C%20right%20click%20on%20either%20the%20increment%20or%20decrement%20buttons%20in%20the%20original%20then%20click%20view%20code%20it%20takes%20me%20to%20(%20Const%20procName%20As%20String%20%3D%20%E2%80%9CChangeStockButton_Click%E2%80%9D).%20I%20get%20the%20same%20outcome%20on%20your%20version.%20If%20I%20do%20the%20same%20for%20the%20run%20parts%20reorder%20report%20button%20I%20get%20the%20same%20outcome%20but%20just%20with%20the%20destination%20(Const%20procName%20As%20String%20%3D%20%E2%80%9CRunPartsReorderReport%E2%80%9D)%20on%20both%20your%20version%20and%20the%20original.%3CBR%20%2F%3EIf%20I%20click%20on%20the%20run%20parts%20reorder%20report%20button%20on%20your%20version%20(magic%20happens%20and%20the%20results%20populate%20to%20the%20correct%20sheet)%20if%20I%20do%20the%20same%20on%20the%20original%20I%20get%20an%20error%20(object%20variable%20or%20with%20block%20variable%20not%20set).%20If%20I%20go%20to%20the%20Visual%20Basic%20and%20position%20the%20cursor%20to%20the%20left%20of%20Public%20Sub%20(%20for%20RunPartsReorderReport)%20click%20play%20I%20get%20(Run_time%20error%20%E2%80%9891%E2%80%99%3A%20Object%20variable%20or%20with%20block%20variable%20not%20set)%3CBR%20%2F%3E%3CBR%20%2F%3EWhen%20I%20try%20the%20increment%20and%20decrement%20buttons%20on%20the%20original%20I%20get%20(%20Error%3A%201004%3A%20Method%20%E2%80%98Range%E2%80%99%20of%20object%20%E2%80%99_Worksheet%E2%80%99%20failed)%20when%20I%20go%20through%20the%20Visual%20Basic%20play%20method%20I%20get%20(%20Error%3A%201004%3A%20Method%20%E2%80%98Range%E2%80%99%20of%20object%20%E2%80%99_Worksheet%E2%80%99%20failed)%20but%20when%20I%20try%20both%20method%20on%20your%20version%20(magic%20everything%20works).%20So%20my%20guess%20is%20that%20again%20it%E2%80%99s%20my%20fault%2C%20I%E2%80%99ve%20definitely%20done%20something%20wrong%20that%20your%20Vba%20doesn%E2%80%99t%20like.%3CBR%20%2F%3EHow%20would%20be%20the%20best%20way%20to%20correct%20these%20issues%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1609132%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1609132%22%20slang%3D%22en-US%22%3EIs%20it%20possible%20that%20you%20can%20upload%20a%20copy%20of%20the%20workbook%20that%20is%20misbehaving%20(you%20can%20remove%20the%20worksheets%20that%20comprise%20the%20picture%20catalog%2C%20anything%20that%20is%20sensitive%2C%20or%20even%20most%2Fall%20of%20the%20parts%20list%20data%20if%20you%20need%20to)%3F%3CBR%20%2F%3E%3CBR%20%2F%3EI%20should%20be%20able%20to%20figure%20out%20what%20it%20doesn't%20like%20and%20then%20help%20with%20some%20instructions%20to%20fix%20the%20original%20file.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1609250%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1609250%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F675152%22%20target%3D%22_blank%22%3E%40JMB17%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ehere%20is%20a%20copy%20of%20the%20workbook%2C%20good%20luck%2C%20I%20think%20I%20was%20just%20being%20over%20cautious%20last%20time%2C%20as%20my%20company%20is%20really%20strict%20about%20the%20use%20of%20their%20computers%2C%20with%20the%20risk%20of%20viruses%20etc.%20so%20is%20there%20ant%20way%20for%20me%20to%20be%20able%20to%20update%20the%20original%20workbook.%20with%20the%20repaired%20workbook%20from%20yourself%20without%20the%20possibility%20of%20contaminating%20the%20original%2F%20works%20company%20network%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1609315%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1609315%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F762853%22%20target%3D%22_blank%22%3E%40StevieGis01%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYes.%20I%20believe%20all%20you%20need%20to%20do%20is%20name%20the%20cells%20in%20your%20header%20row%20(row%204)%20in%20the%20name%20manager.%3C%2FP%3E%3CP%3EIf%20you%20look%20at%20my%20file%2C%20you'll%20see%20that%20I%20named%20all%20of%20the%20cells%20in%20Row%204%20(click%20on%20a%20header%20cell%20in%20row%204%20and%20you'll%20see%20the%20name%20in%20the%20name%20box).%20And%20if%20you%20look%20in%20the%20vba%20code%20near%20the%20top%20of%20the%20module%2C%20you%20will%20see%20a%20list%20of%20Private%20Const%20xxxxxxRngName%20%3D%20%22xxxxxxxx%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%2C%20I%20don't%20believe%20you%20will%20actually%20need%20all%20of%20them%20(I%20named%20the%20cells%20up%20front%20before%20writing%20any%20code%2C%20but%20it%20turns%20out%20I%20didn't%20actually%20use%20all%20of%20them).%20You%20will%20only%20actually%20need%20to%20name%20columns%20M%20through%20R.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20attached%20a%20screenshot%20of%20the%20six%20you%20need.%20To%20add%20the%20names%20on%20the%20excel%20worksheet%20side%20(walk%20you%20through%20the%20first%20one%20for%20the%20Min%20Stock%20column)%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E1)%20click%20on%20the%20Parts%20List%20tab%3CBR%20%2F%3E2)%20click%20on%20Formulas%5CName%20Manager%3CBR%20%2F%3E3)%20select%20New%3CBR%20%2F%3E4)%20Name%20(see%20screenshot%20-%20the%20name%20I%20used%20will%20be%20on%20the%20right%20of%20the%20%3D%20sign)%3A%20Stock_Min%3CBR%20%2F%3EScope%3A%20Parts%20List%3CBR%20%2F%3ERefers%20to%3A%20%3D'Parts%20List'!%24M%244%20(or%20click%20on%20the%20little%20arrow%20button%20to%20right%20of%20the%20box%20and%20select%20cell%20M4).%3CBR%20%2F%3E5)%20click%20OK%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThen%2C%20repeat%20for%20the%20other%20five.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1609468%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1609468%22%20slang%3D%22en-US%22%3EYour%20fantastic%2C%20everything%20is%20working%20correctly%20now%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%3CBR%20%2F%3E%3CBR%20%2F%3EI%20can't%20thankyou%20enough%2C%3CBR%20%2F%3E%3CBR%20%2F%3EIs%20there%20anything%20I%20can%20do%20to%20say%20thankyou%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1609574%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1609574%22%20slang%3D%22en-US%22%3EThank%20you%20is%20plenty.%20I'm%20glad%20to%20see%20you%20got%20it%20working.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1610975%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1610975%22%20slang%3D%22en-US%22%3ESorry%20me%20again%2C%20hopefully%20this%20is%20the%20last%20issue%2C%20I%20was%20going%20through%20the%20workbook%20with%20the%20boss%20showing%20him%20all%20your%20hard%20work%20and%20come%20across%20a%20wee%20hiccup.%20Because%20I%20need%20the%20sheets%20locked%20to%20stop%20to%20stop%20them%20from%20being%20changed.%20I%20had%20locked%20them%20all%20and%20when%20I%20click%20any%20of%20the%20buttons%20the%20code%20runs%20but%20will%20not%20paste%20to%20the%20destinations%20unless%20they%20are%20unlocked%2C%20I%20dose%20tell%20you%20that%20in%20a%20message%20window%20though.%20But%20the%20stock%20still%20increases%20or%20decreases%20without%20the%20paste%2C%20the%20reorder%20report%20runs%20(I%20think)%20But%20again%20no%20paste%20unless%20the%20reorder%20sheet%20is%20unlocked.%20I%20know%20that%20makes%20sense%2C%20But%20is%20there%20a%20way%20to%20unlock%20the%20destination%20sheets%20and%20relight%20them%20again%20within%20the%20same%20code%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1611466%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1611466%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F762853%22%20target%3D%22_blank%22%3E%40StevieGis01%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYes.%20I%20modified%20the%20Reorder%20Parts%20and%20Change%20Inventory%20macros%20to%20also%20unlock%2Frelock%20the%20destination%20worksheets.%26nbsp%3BYou%20should%20be%20able%20to%20copy%2Fpaste%20this%20revised%20code%20from%20the%20Parts%20List%20module%20into%20your%20workbook.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20assuming%20the%20worksheets%20all%20use%20the%20same%20password%2C%20which%20you%20may%20have%20noticed%20is%20defined%20by%20the%20constant%20at%20the%20top%20of%20the%20module%20(PWord).%20I%20think%20it%20is%20currently%20set%20to%20vbnullstring%2C%20but%20change%20that%20to%20whatever%20you%20need%20(enclosed%20in%20quotes%2C%20Const%20PWord%20As%20String%20%3D%20%22MyPassword%22)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMake%20a%20copy%2Fbackup%20of%20your%20file%2C%20just%20in%20case.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1656154%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1656154%22%20slang%3D%22en-US%22%3EHi%20JMB17%3CBR%20%2F%3E%3CBR%20%2F%3EIt%20been%20a%20few%20weeks%20since%20we%20last%20spoke%2C%20our%20workbook%20is%20working%20well%2C%20but%20I%E2%80%99ve%20noticed%20a%20slight%20problem.%20Within%20each%20worksheet%20I%20have%20auto%20filters%20that%20work%20fine%20when%20the%20worksheet%20is%20locked%20but%20when%20any%20of%20the%20function%20buttons%20are%20clicked%20(Vba%20operates%20as%20it%20should)%20the%20worksheets%20unlock%20then%20lock%20again%20when%20code%20it%20finished%20running.%20My%20issue%20is%20after%20any%20vba%20runs%20and%20locks%20the%20sheet%20the%20auto%20filters%20no%20longer%20work%2C%20I%20have%20to%20unlock%20the%20sheet%20reselect%20auto%20sort%20and%20the%20lock%20the%20sheet%20again.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1661481%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1661481%22%20slang%3D%22en-US%22%3EHi%20JMB17%3CBR%20%2F%3E%3CBR%20%2F%3EIt%E2%80%99s%20been%20a%20wee%20while%20from%20our%20last%20chat%2C%20the%20spreadsheet%20is%20working%20great%2C%20but%20there%E2%80%99s%20a%20small%20issue%20that%20I%E2%80%99ve%20noticed%2C%20I%E2%80%99ve%20auto%20sort%20function%20enabled%20in%20the%20protected%2F%20locked%20sheets.%20The%20auto%20sort%20works%20fine%20on%20all%20the%20locked%20sheets%20until%20any%20of%20our%20VBA%20buttons%20are%20clicked%2C%20after%20the%20code%20runs%20the%20auto%20sort%20stops%20working%20until%20you%20manually%20unlock%20re-enable%20and%20then%20lock%20again%2C%20but%20again%20of%20any%20buttons%20is%20VBA%20button%20is%20clicked%20then%20it%20stops%20again.%20I%20assume%20this%20is%20fixable%2C%20but%20I%20can%E2%80%99t%20work%20out%20how%20to%20rectify%20it.%20Any%20help%20would%20be%20great%2C%20thanks%20in%20advance%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1661963%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1661963%22%20slang%3D%22en-US%22%3ESorry%20for%20the%20late%20response.%20I%20saw%20the%20notification%2C%20but%20when%20I%20clicked%20on%20it%2C%20there%20were%20no%20new%20comments.%20I%20only%20saw%20this%20when%20I%20went%20to%20your%20profile.%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20you%20locate%20the%20lines%20in%20the%20code%20that%20are%20applying%20protection%20to%20the%20various%20worksheets%2C%20you%20can%20modify%20it%20to%20allow%20filtering%20by%20adding%20a%20comma%20and%20AllowFiltering%3A%3DTrue%3CBR%20%2F%3E%3CBR%20%2F%3EFor%20example%3A%3CBR%20%2F%3EMe.Protect%20Password%3A%3DPword%2C%20AllowFiltering%3A%3DTrue%3CBR%20%2F%3E%3CBR%20%2F%3EI%20believe%20there%20are%205%20places%20where%20it%20is%20re-protecting%20worksheets.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1662459%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1662459%22%20slang%3D%22en-US%22%3EHi%20JMB17%20hope%20alls%20well%20with%20you%20and%20your%20family.%3CBR%20%2F%3E%3CBR%20%2F%3EAs%20always%20such%20an%20easy%20fix%20for%20yourself%2C%20that%20cured%20it.%20I%20feel%20like%20a%20right%20spanner%2C%20I%20really%20can%E2%80%99t%20thank%20you%20enough%20just%20wish%20there%20was%20a%20way%20to%20repay%20you%20for%20all%20your%20time%20and%20expertise.%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%20again%3CBR%20%2F%3EStevie%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1662692%22%20slang%3D%22en-US%22%3ERe%3A%20Vba%20code%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1662692%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F762853%22%20target%3D%22_blank%22%3E%40StevieGis01%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou're%20welcome.%20Glad%20to%20hear%20that%20fixed%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor
Hi, I’ve been tasked with creating a parts spreadsheet in work, so for the past six weeks I have itemised over 2000 parts. After completing the data input I’ve set about making it more user friendly, but have been beaten by my limits on vba. I have manage to 3 vba codes to preform different tasks across 4 mains worksheets (parts list, re-order report, parts movement, catalogue). I’ve made over 4000 function buttons to preform 2 different tasks. 2000 increase parts list cells (Q1:Q2000) by +1 if. clicked. The other 2000 buttons decrease the same cells by -1 if clicked. My third code is also a button which runs a re order report by searching for the word YES in cells (R1:R2000) then copying the rows and populating them into the reorder sheet. But while running my spreadsheet within my maintenance team I encountered a problem, I have no record of parts movement. For the past week I’ve tried and tried and searched the internet but have came up short, in my search a and code building. I need a code to Automatically (no buttons) read cells(Q1:Q2000) for any change (these cells are increased and decreased by 1 with each click of the 2000 add buttons and 2000 remove buttons. The code then needs to copy each row in which the Q cell has increased or decreased (cells A to L) and paste them into parts movement sheet starting in row 5 and pasting into cells ( A to L) . The code also needs to allow the pasted rows to stay and to just create another row if the same part has been increased or decreased. I also need the pasted rows in parts movement sheet to be Timestamped this would allow a history for both used and restocked parts.
24 Replies

@StevieGis01 My first thought is that a spreadsheet with 4000 (!) buttons is overwhelming. Especially when you are talking about "only" 2000 parts to track. There must be a simpler way, although I do not know how you have structured your data or what exactly you are asked to deliver.

 

I would probable start having a parts table and a transactions table and link them together using one of Excel's LOOKUP functions, Pivot Tables and/or Power Query / Power Pivot, and do the reporting (plus and minus and history) from there. But again, I have no idea about your real life situation. So, perhaps my thoughts are completely out of line.

Hi 

@Riny_van_Eekelen Thankyou for your replay, I forgot to mention that im not very good with computers I'm just an electrician. What you said made me rethink my parts. I've now drastically reduced my parts list down to a maximum of 200 across 12 different spreadsheets (1 for each of our machines). 

All my machine spreadsheets are set out the same way, as follows

1. Parts List (Sheet1)

2. Reorder Parts Report (Sheet2)

3. Parts Removed (Sheet3)

4. Parts Added(Sheet4)

The parts list (Sheet1) has a max of 200 rows, each row uses cells (A:S),

On sheet1 I've made a vba button to run a reorder parts report. When clicked the code unlocks sheet1, clears all cells in sheet2, looks for "YES" within cells (R:R200), it then copies the rows cells(A:L,Q,R,S) from sheet1, pastes the rows onto the parts reorder report sheet (Sheet2), then locks sheet1 again.

 

Within all sheet1 cells (o) I've made a vba button to unlock sheet1, then reduce the value in cell (Q) by 1, then copy cells (A:L,Q,R,S) of the same row and paste them into Sheet3 in the next available row, then return back to sheet1 cell (A) of the same row which had been reduced, and lock sheet1 again.

 

Within all sheet1 cells (p) I've made a vba button to unlock sheet1, then increase the value in cell (Q) by 1, then copy cells (A:L,Q,R,S) of the same row and paste them into Sheet4 in the next available row, then return back to sheet1 cell (A) of the same row which had been reduced, and lock sheet1 again.

 

If Possible could you help me with tidying up my already made vba and give and also help me to create a time stamp in cell(o) for both sheet3 and sheet4 for each row that pastes to give me some sort of parts tracking.

 

My vba codes are

 

Public Sub RunReOrderReport()

'

'       Clear Re Order Sheet First

'       Run Re Order Count

'       Based On Re Order Colum "YES" OR " NO"

'       Copy Row and Paste on to Re order Sheet

'       Continue Though Sheet Until Complete

'       End

'

    ThisWorkbook.Worksheets("Parts List").Unprotect ("Password") ' Unlock Sheet

    Sheets("Re Order Parts Report").Cells.Clear 'Clear Re Order Sheet

    Dim c As Range

    Dim j As Integer

    Dim Source As Worksheet

    Dim Target As Worksheet

'

'       Source "Parts List" ("Sheet1")

'       Target "Re Order Parts Report" ("Sheet2")

'

    j = 2   'Start Copying To Row 2 In Target Sheet          

                Set Target = ThisWorkbook.Worksheets("Re Order Parts Report")               

'       For Each c In

                Set Source = ThisWorkbook.Worksheets("Parts List")         

        For Each c In Source.Range("G1:G1000")      

'        Do 1000 Rows 

            If c = "YES" Then           

'        ("Shee1"),Range.Value = "YES" = TRUE     

               ' Source , ThisWorkbook.Worksheets("Sheet1").Rows.c, Copy.Row = 2, Copy.Target.Rows(j)               

                  Source.Rows(c.Row).Copy Target.Rows(j)

                j = j + 1

            End If

        Next c

    ThisWorkbook.Worksheets("Parts List").Protect ("Password")

End Sub

 

 

Public Sub MinusOnePartClickButtonTest()
'
' PartsRemoved Macro
' if -1 button clicked copy stock and row to parts removed sheet
'
ThisWorkbook.Worksheets("Parts List").Unprotect ("Password") ' Unlock Sheet
Sheets("Parts List").Select
Range("F8").Value = Range("F8").Value - 1
Range("A8,F8").Select
Range("F8").Activate
Selection.Copy
Sheets("Parts Removed").Select
Range("A" & Rows.Count).End(xlUp).Offset(1).Select
ActiveSheet.Paste
ActiveSheet.Paste
Sheets("Parts List").Select
Range("A8").Select
Application.CutCopyMode = False
Range("A8").Select
ThisWorkbook.Worksheets("Parts List").Protect ("Password") ' Lock Sheet
End Sub

 

 

Public Sub AddOnePartClickButtonTest()
'
' PartsRemoved Macro
' if -1 button clicked copy stock and row to parts removed sheet
'
ThisWorkbook.Worksheets("Parts List").Unprotect ("Password") ' Unlock Sheet
Sheets("Parts List").Select
Range("F8").Value = Range("F8").Value + 1
Range("A8,F8").Select
Range("F8").Activate
Selection.Copy
Sheets("Parts Added").Select
Range("A" & Rows.Count).End(xlUp).Offset(1).Select
ActiveSheet.Paste
ActiveSheet.Paste
Sheets("Parts List").Select
Range("A8").Select
Application.CutCopyMode = False
Range("A8").Select
ThisWorkbook.Worksheets("Parts List").Protect ("Password")
End Sub

 

I Hope this makes sense  as I couldn't figure out how to make my vba look the same as everybody else's post's on here

 

Thanks again

@StevieGis01 Hi there! Thanks for sharing. Quite a bit of extra information to digest. Am preparing for a small road trip just now and don't know how much time I'll have to look into this over the next few days. In the meantime, perhaps someone else out here can have a look at it. In order to increase your chances for a response you can perhaps upload one of your files (for one machine). Replace any confidential information with some faked data though.

Best Response confirmed by StevieGis01 (Occasional Contributor)
Solution

@StevieGis01 

 

Cleaning up the code is often a matter of removing "select" and "activate" and joining whatever was selected/activated with the action. Instead of

 

Range("A1").Select

Selection.Value = 10

 

it can be shortened to just

Range("A1").Value = 10

 

Just my two cents, but since these two procedures have a lot of overlap, you could set up a third procedure to do the work and just pass it the value by which to increase/decrease the cell. And, if you had cells other than F8 that this process worked on, you could pass it the applicable cell(s) on the Parts List worksheet.

 

Or, you could have the user select the cells they want to increment/decrement and have the macro work on whatever range the user has selected?

 

Public Sub MinusOnePartClickButtonTest()
     ChangePartCount -1
End Sub

Public Sub AddOnePartClickButtonTest()
     ChangePartCount 1
End Sub

Public Sub ChangePartCount(changeValue As Integer)
     Dim destWkSht As Worksheet
     Dim destCell As Range
     Dim timeStampCell As Range
     
     
     On Error GoTo ErrHandler
     
     
     If changeValue < 0 Then
          Set destWkSht = Sheets("Parts Removed")
     ElseIf changeValue > 0 Then
          Set destWkSht = Sheets("Parts Added")
     Else
          Exit Sub
     End If
     
     
     With destWkSht
          Set destCell = .Range("A" & .Rows.Count).End(xlUp).Offset(1)
          Set timeStampCell = Intersect(.Range("O:O").EntireColumn, destCell.EntireRow)
     End With


     With ThisWorkbook.Worksheets("Parts List")
          .Unprotect ("Password") ' Unlock Sheet
          .Range("F8").Value = .Range("F8").Value + changeValue
          .Range("A8,F8").Copy destCell
          .Protect ("Password") ' Lock Sheet
     End With
     
     timeStampCell.Value = Now
     
     Application.CutCopyMode = False


ExitProc:
     Set destCell = Nothing
     Set destWkSht = Nothing
     Exit Sub
     
ErrHandler:
     MsgBox "Error " & Err.Number & ": " & Err.Description
     Resume ExitProc
     
End Sub

 

 

Hi@JMB17 

Thankyou for your very swift reply, I've no doubt that your code is correct and I sound exactly what I was looking for.

 

However I'm sure I must be doing something wrong because I can't get the code to run on my system.

 

After reading your reply and looking through your code I'd realised I send you a mixture of 2 different spreadsheet details. I made the real spreadsheet but because I know very little about VBA I made a very small test spreadsheet to play around with so that I wouldn't mess up all my hard work and the cell destinations where from the test spreadsheet with the correct sheet names from the main spreadsheet. So I've included a copy of both the main spreadsheet (with any sensitive details removed) 

 

Also could you advise me on

Within my VBA (Sheet1.RunPartsReorderReport)

1. help me to only clear from row 2 downwards in my Run Reorder Parts Report (is clears the previous report before pasting the next)

2. How to only copy cells (A:L,Q,R,S) 

 

Your code is called (Sheet1.PartsInventoryPartTracker)

It runs about 80/90% of the code then stops at the line:

  MsgBox "Error " & Err.Number & ": " & Err.Description

I changed the Value Range From ("F8") To ("Q4:Q250")  and the copy Range from("A8,F8") To ("A:L,Q,R,S")           I hope this isn't the problem

I'll take a look at it. But, it may have to wait until this weekend.
No problem, thanks for all your help, I viewed the download I sent you and my -1&+1 buttons don’t work because I had the running when the original workbook was opened, but the codes for them are in the viewer,
Thanks again you great
The range reference ("A8,F8") will work, but ("A:L,Q,R,S") will not (no worries, we can fix it).

I see that you have increment/decrement buttons in row 5, columns O and P. Are these buttons dedicated to row 5 (i.e. - in your master version, do you have buttons for each row that increment/decrement the current stock level only for the item in that specific row)? I guessing that is the case based on your original post regarding having 4k buttons for 2k parts.

If so, I would agree with Riny that seems pretty overwhelming. Particularly when you consider making updates (adding parts or removing discontinued parts), as each button is hardcoded to a specific row (so, if you insert/delete rows, you have to update the vba code for all of the cells that got moved up/down and delete/add buttons and their respective vba code).

If you are open to suggestions, I would just have 2 buttons (increment/decrement) above the column that change the stock quantity in the same row as the active cell. So, the user selects the row they want to change, then clicks the button, and the stock quantity changes in column Q of that same row. Then you are free to update your table w/o having to update any of your increment/decrement code.



Yes that’s correct, I’ve 2 buttons in every row that control the stock level cell then copy the row to the appropriate sheet ie. -1 button go to parts removed sheet, and +1 button go to parts added. It was a nightmare creating all the buttons, but that’s all I knew at the time.

Your suggestion sounds perfect, but I wouldn’t even know where to start, would it be able when the cell is selected and the correct button clicked will the stock level change up or down depending on which button is pressed. Then after the level changes the row is copied the to appropriate sheet and time stamp the new row in the new sheet also? If all that is possible great, will this code still allow the run parts reorder report to work,

This sound like a lot of work for yourself on my behalf.

Any help any greatly appreciated, it’s nice to be able to speak with Vba guru, my google searches only throw back the same things but described differently.

Thanks again for all you help

@StevieGis01 

 

See if the attached workbook does what you are looking to do.

 

I named the cells in the last row of the table header. Instead of referring to a range by it's address, Range("Q4"), you can refer to it also by it's name (if it is named), such as Range("Current_Stock") if cell Q4 is named "Current_Stock". The advantage is that if you modify your table (insert rows/columns or cut/paste columns so they are in a different order), your code can still find the named range whereas Range("Q4") will always refer to Q4 (it doesn't realize Q4 was moved because you inserted/deleted a row/column above or to the left of it).  

 

I also set up some constants in the code module that refer to the names of the header cells. So, if you change the names of the cells, you only have to update the constants that refer to them. 

 

I added two forms buttons (not activex buttons), which are named "DecrementButton" and "IncrementButton" at the top of the current stock column. Both of these buttons are assigned to the macro "ChangeStockButton_Click." The macro will check the name of the button that called it and increment/decrement the current stock in the same row as the active cell (you don't have to actually be in column Q, just on the same row).

 

Then, "ChangeStockButton_Click" will call "CopyInvChange," which will copy the row of the item that was changed (excluding the min, initial, removed, and added fields) to the "Parts Added" or "Parts Removed" worksheets.

 

Note that worksheets actually have two names - tab name and code name. If you look at the worksheets listed in vba's project explorer window (view\project explorer), the code name is the first name listed and the tab name is in parentheses. Instead of Worksheets("Parts List").Range("A1"), you could use Sheet1.Range("A1"). That way, when users change the worksheet tab name, your code is not affected.

 

Excel has quite a few tools for referring or navigating worksheet ranges. As much as possible, I try to avoid referring to ranges by their actual cell address so your macros are more flexible to changes made to the worksheet. These are a few that I used:

 

CurrentRegion - refers to a region, such as a table. In this file, refers to A1:S209

 

UsedRange - refers to a worksheets "used range." Instead of looping through all of the cells in the entire column, you can limit your search to the used range (no point in checking all of the empty cells in the unused range).

 

Intersect - returns the range/cells in common  between two other ranges. Intersect(cell1.entirerow, cell2.entirecolumn) is one way to find the cell on the same row, but in another column.

 

Union - merges two or more ranges together (not on the worksheet itself, but your vba range variable).

 

 

@StevieGis01 

 

Take a look at the file and see if that is what you have in mind. I added a worksheet with comments to provide some additional explanation of what I did. Hopefully, it makes sense.

 

Excel has quite a few ways to refer to worksheet ranges, instead of using their cell address, that can help make the vba procedures less susceptible to breaking because a user (or you) moved things around (like cut/paste the table fields because you want them to appear in a different order, or inserting rows above your header row, or deleting some rows/columns - depending on what's deleted).

 

 

 

 

 

Hi
Yes everything that you’ve, done is exactly what I was hoping to achieve when I started out, and it works flawlessly on your file.
I’ve been trying from when you first sent the updated version to get it to work on the original which is on my company’s internal network (visible to everyone when they log in) but I can’t get it to work/run. The only Vba code I’ve got on the original file is your Vba and it’s on sheet1 just like your file. I started by firstly deleting everything to do with Vba from the original. After copying and pasting the new header names and layout from your to the original ( so they now look identical), I then copied and pasted the first 2 rows from yours to the original that then gave me the buttons and title, I then opened Visual Basic and made sure that there was no modules or anything that shouldn’t be there then is pasted your code to sheet1 of the Visual Basic. So now when I’ve got your version open on my laptop ant the original open on my work computer the only difference is that the original has a further 16 sheets ( a picture catalogue Of all the parts) but these sheets are not nothing to do with the Vba code so should have no bearing on the outcome of any of the Vba code running ( or so I think).
If I open design mode, right click on either the increment or decrement buttons in the original then click view code it takes me to ( Const procName As String = “ChangeStockButton_Click”). I get the same outcome on your version. If I do the same for the run parts reorder report button I get the same outcome but just with the destination (Const procName As String = “RunPartsReorderReport”) on both your version and the original.
If I click on the run parts reorder report button on your version (magic happens and the results populate to the correct sheet) if I do the same on the original I get an error (object variable or with block variable not set). If I go to the Visual Basic and position the cursor to the left of Public Sub ( for RunPartsReorderReport) click play I get (Run_time error ‘91’: Object variable or with block variable not set)

When I try the increment and decrement buttons on the original I get ( Error: 1004: Method ‘Range’ of object ’_Worksheet’ failed) when I go through the Visual Basic play method I get ( Error: 1004: Method ‘Range’ of object ’_Worksheet’ failed) but when I try both method on your version (magic everything works). So my guess is that again it’s my fault, I’ve definitely done something wrong that your Vba doesn’t like.
How would be the best way to correct these issues?
Is it possible that you can upload a copy of the workbook that is misbehaving (you can remove the worksheets that comprise the picture catalog, anything that is sensitive, or even most/all of the parts list data if you need to)?

I should be able to figure out what it doesn't like and then help with some instructions to fix the original file.

@JMB17 

 

here is a copy of the workbook, good luck, I think I was just being over cautious last time, as my company is really strict about the use of their computers, with the risk of viruses etc. so is there ant way for me to be able to update the original workbook. with the repaired workbook from yourself without the possibility of contaminating the original/ works company network? 

@StevieGis01 

 

Yes. I believe all you need to do is name the cells in your header row (row 4) in the name manager.

If you look at my file, you'll see that I named all of the cells in Row 4 (click on a header cell in row 4 and you'll see the name in the name box). And if you look in the vba code near the top of the module, you will see a list of Private Const xxxxxxRngName = "xxxxxxxx".

 

But, I don't believe you will actually need all of them (I named the cells up front before writing any code, but it turns out I didn't actually use all of them). You will only actually need to name columns M through R.

 

I attached a screenshot of the six you need. To add the names on the excel worksheet side (walk you through the first one for the Min Stock column)


1) click on the Parts List tab
2) click on Formulas\Name Manager
3) select New
4) Name (see screenshot - the name I used will be on the right of the = sign): Stock_Min
Scope: Parts List
Refers to: ='Parts List'!$M$4 (or click on the little arrow button to right of the box and select cell M4).
5) click OK

 

Then, repeat for the other five.

Your fantastic, everything is working correctly now

I can't thankyou enough,

Is there anything I can do to say thankyou?
Thank you is plenty. I'm glad to see you got it working.
Sorry me again, hopefully this is the last issue, I was going through the workbook with the boss showing him all your hard work and come across a wee hiccup. Because I need the sheets locked to stop to stop them from being changed. I had locked them all and when I click any of the buttons the code runs but will not paste to the destinations unless they are unlocked, I dose tell you that in a message window though. But the stock still increases or decreases without the paste, the reorder report runs (I think) But again no paste unless the reorder sheet is unlocked. I know that makes sense, But is there a way to unlock the destination sheets and relight them again within the same code

@StevieGis01 

 

Yes. I modified the Reorder Parts and Change Inventory macros to also unlock/relock the destination worksheets. You should be able to copy/paste this revised code from the Parts List module into your workbook. 

 

I'm assuming the worksheets all use the same password, which you may have noticed is defined by the constant at the top of the module (PWord). I think it is currently set to vbnullstring, but change that to whatever you need (enclosed in quotes, Const PWord As String = "MyPassword")

 

Make a copy/backup of your file, just in case.