Populating cell data from one workbook to another - checkboxes/buttons/VBA?

%3CLINGO-SUB%20id%3D%22lingo-sub-1884774%22%20slang%3D%22de-DE%22%3ESubject%3A%20Populating%20cell%20data%20from%20one%20workbook%20to%20another%20-%20checkboxes%2Fbuttons%2FVBA%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1884774%22%20slang%3D%22de-DE%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F684222%22%20target%3D%22_blank%22%3E%40iapetustitan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20is%20a%20VBA%20example%2C%20untested.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3ESub%20data_walk%20()%0A%20%20%20%20Dim%20wbA%20As%20Workbook%0A%20%20%20%20Dim%20wbB%20As%20Workbook%0A%20%20%20%20Dim%20wbNeu%20As%20Workbook%0A%0A%20%20%20%20'Open%20the%20%22B.xls%22%20file%20if%20it%20is%20not%20already%20open%0A%20%20%20%20Application.DisplayAlerts%20%3D%20False%0A%20%20%20%20Workbooks.Open%20Filename%3A%20%3D%20%22C%3A%20%5C%20Code%20%5C%20B.xls%22%0A%20%20%20%20Application.DisplayAlerts%20%3D%20True%0A%0A%20%20%20%20Set%20wbA%20%3D%20Workbooks%20(%22A.xls%22)%0A%20%20%20%20Set%20wbB%20%3D%20Workbooks%20(%22B.xls%22)%0A%0A%20%20%20%20'create%20new%20workbook%20....%20will%20later%20be%20%22C.xls%22%0A%20%20%20%20Application.Workbooks.Add%0A%20%20%20%20Set%20wbNeu%20%3D%20ActiveWorkbook%0A%0A%20%20%20%20'Example%3A%20cells%20A1%20and%20A2%20from%20folder%20%22B.xls%22%20are%20multiplied%20together%0A%20%20%20%20'and%20the%20result%20is%20written%20into%20the%20new%20folder%20%2F%20cell%20A1%0A%20%20%20%20wbNeu.Sheets%20(1)%20.Range%20(%22A1%22)%20%3D%20wbB.Sheets%20(1)%20.Range%20(%22A1%22)%20*%20wbB.Sheets%20(1)%20.Range%20(%22A2%22)%0A%0A%20%20%20%20'The%20folder%20is%20saved%20as%20%22C%3A%20%5C%20Code%20%5C%20C.xls%22%0A%20%20%20%20Application.DisplayAlerts%20%3D%20False%0A%20%20%20%20wbNeu.SaveAs%20Filename%3A%20%3D%20%22C%3A%20%5C%20Code%20%5C%20C.xls%22%0A%20%20%20%20Application.DisplayAlerts%20%3D%20True%0A%0A%20%20%20%20'Folder%20%22B.xls%22%20is%20closed%20(without%20saving)%0A%20%20%20%20Application.DisplayAlerts%20%3D%20False%0A%20%20%20%20Workbooks%20(%22B.xls%22).%20Close%0A%20%20%20%20Application.DisplayAlerts%20%3D%20True%0A%20%20%20%20End%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EFor%20the%20example%2C%20the%20%22B.xls%22%20file%20should%20contain%20numbers%20in%20cells%20A1%20and%20A2.%3C%2FP%3E%3CP%3EThe%20macro%20is%20started%20from%20file%20%22A.xls%22%20and%20opens%20file%20%22C%3A%20%22%20Code%20%22%20B.xls%20%22%20(if%20not%20already%20open)%2C%20cells%20A1%20and%20A2%20are%20multiplied%20from%20this%20file%20and%20the%20result%20in%20cell%20A1%20in%20the%20new%20file%20%22C%3A%20%22%20Code%20%22%20C.xls%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFished%20from%20the%20internet%20...%20don't%20ask%20me%20where%2C%20believe%20from%20some%20German%20site.%3C%2FP%3E%3CP%3ESimply%20sent%20as%20an%20example%2C%20it%20may%20help%20you%20in%20your%20project.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20I%20was%20able%20to%20help%20you.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENikolino%3C%2FP%3E%3CP%3EI%20know%20I%20don't%20know%20anything%20(Socrates)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E*%20Kindly%20Mark%20and%20Vote%20this%20reply%20if%20it%20helps%20please%2C%20as%20it%20will%20be%20beneficial%20to%20more%20community%20members%20reading%20here%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1884841%22%20slang%3D%22en-US%22%3EBetreff%3A%20Populating%20cell%20data%20from%20one%20workbook%20to%20another%20-%20checkboxes%2Fbuttons%2FVBA%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1884841%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F722750%22%20target%3D%22_blank%22%3E%40Nikolino%3C%2FA%3E%26nbsp%3BThanks%2C%20I'll%20take%20a%20look%20at%20that.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1884640%22%20slang%3D%22en-US%22%3EPopulating%20cell%20data%20from%20one%20workbook%20to%20another%20-%20checkboxes%2Fbuttons%2FVBA%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1884640%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20there.%20Looking%20for%20some%20info%20on%20auto%20populating%20certain%20cells%20with%20certain%20data%20from%20one%20spreadsheet%20to%20another.%3CBR%20%2F%3ETwo%20sheets%20attached.%20The%20'Test_draft_1'%20is%20a%20first%20draft%20idea%20for%20a%20(large)%20stock%2Finventory%20sheet%20covering%20multiple%20areas.%20Just%20playing%20with%20ideas%20to%20see%20what%20works%20best%20for%20our%20needs%2C%20I'm%20still%20learning%20the%20ropes%20with%20excel%20so%20go%20easy.%3CBR%20%2F%3E%3CBR%20%2F%3EGenerally%2C%20everything%20works%20as%20needed%20(there%20are%20a%20lot%20more%20item%20types%20to%20populate%20so%20it%20will%20get%20even%20longer%2C%20sadly)%20but%20I'm%20trying%20to%20come%20up%20with%20a%20way%20to%20create%20a%20new%20order%20form%20for%20specific%20items%20that%20require%20a%20re-order.%20My%20thoughts%20were%20a%20checkbox%20system%20or%20similar%20where%2C%20once%20all%20selected%2C%20the%20choices%20could%20be%20'confirmed'%20and%20the%20selected%20data%20copied%20to%20an%20order%20form%20(actual%20order%20form%20also%20attached%20-%20no%20scope%20for%20changing%20this%20except%20where%20I%20might%20be%20able%20to%20continually%20(and%20automatically)%20add%20new%20rows%20as%20needed).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIdeally%2C%20the%20price%20per%20item%20would%20also%20copy%20across%20(that%20data%20not%20in%20the%20Draft%20sheet%20right%20now)%20and%2C%20in%20a%20dream%20scenario%2C%20could%20even%20suggest%20quantity%20before%20'confirming'%20data.%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EI%20know%20I'm%20asking%20a%20lot%20from%20a%20spreadsheet%20but%20I%20need%20to%20come%20up%20with%20something%20while%20we%20wait%20to%20get%20confirmation%20for%20SysDevs%20from%20IT%20to%20help%20create%20something%20more%20bespoke%20(looking%20forward%20-%20QR%20scanners%20for%20staff%20to%20update%20movements%2C%20auto%20flagging%20of%20stock%20level%20thresholds%20and%20auto%20order%20form%20completion.%20Can't%20imagine%20excel%20could%20do%20that%20but%20that's%20what%20I'd%20prefer).%3CBR%20%2F%3E%3CBR%20%2F%3EAny%20tips%2C%20pointers%2C%20suggestions%20on%20how%20I%20could%20do%20this%20sheet%20to%20sheet%20'auto'%20transfer%20would%20be%20very%20appreciated.%3CBR%20%2F%3EPoint%20of%20note%3A%20stuck%20on%20Excel%202013.%20No%20scope%20for%20more%20up%20to%20date%20version.%3CBR%20%2F%3E(removed%20all%20'sensitive'%20data)%3CBR%20%2F%3EEDIT%3A%20removed%20posted%20files.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3CBR%20%2F%3E%3CBR%20%2F%3EMalc%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1884640%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%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
Occasional Contributor

Hi there. Looking for some info on auto populating certain cells with certain data from one spreadsheet to another.
Two sheets attached. The 'Test_draft_1' is a first draft idea for a (large) stock/inventory sheet covering multiple areas. Just playing with ideas to see what works best for our needs, I'm still learning the ropes with excel so go easy.

Generally, everything works as needed (there are a lot more item types to populate so it will get even longer, sadly) but I'm trying to come up with a way to create a new order form for specific items that require a re-order. My thoughts were a checkbox system or similar where, once all selected, the choices could be 'confirmed' and the selected data copied to an order form (actual order form also attached - no scope for changing this except where I might be able to continually (and automatically) add new rows as needed).

 

Ideally, the price per item would also copy across (that data not in the Draft sheet right now) and, in a dream scenario, could even suggest quantity before 'confirming' data. 

I know I'm asking a lot from a spreadsheet but I need to come up with something while we wait to get confirmation for SysDevs from IT to help create something more bespoke (looking forward - QR scanners for staff to update movements, auto flagging of stock level thresholds and auto order form completion. Can't imagine excel could do that but that's what I'd prefer).

Any tips, pointers, suggestions on how I could do this sheet to sheet 'auto' transfer would be very appreciated.
Point of note: stuck on Excel 2013. No scope for more up to date version.
(removed all 'sensitive' data)
EDIT: removed posted files. 

 

Thanks

Malc

2 Replies

@iapetustitan 

Here is a VBA example, untested.

Sub data_walk ()
    Dim wbA As Workbook
    Dim wbB As Workbook
    Dim wbNeu As Workbook

    'Open the "B.xls" file if it is not already open
    Application.DisplayAlerts = False
    Workbooks.Open Filename: = "C: \ Code \ B.xls"
    Application.DisplayAlerts = True

    Set wbA = Workbooks ("A.xls")
    Set wbB = Workbooks ("B.xls")

    'create new workbook .... will later be "C.xls"
    Application.Workbooks.Add
    Set wbNeu = ActiveWorkbook

    'Example: cells A1 and A2 from folder "B.xls" are multiplied together
    'and the result is written into the new folder / cell A1
    wbNeu.Sheets (1) .Range ("A1") = wbB.Sheets (1) .Range ("A1") * wbB.Sheets (1) .Range ("A2")

    'The folder is saved as "C: \ Code \ C.xls"
    Application.DisplayAlerts = False
    wbNeu.SaveAs Filename: = "C: \ Code \ C.xls"
    Application.DisplayAlerts = True

    'Folder "B.xls" is closed (without saving)
    Application.DisplayAlerts = False
    Workbooks ("B.xls"). Close
    Application.DisplayAlerts = True
    End Sub

For the example, the "B.xls" file should contain numbers in cells A1 and A2.

The macro is started from file "A.xls" and opens file "C: \ Code \ B.xls \" (if not already open), cells A1 and A2 are multiplied from this file and the result in cell A1 in the new file "C: \ Code \ C.xls \".

 

Fished from the internet ... don't ask me where, believe from some german site.

Simply sent as an example, it may help you in your project.

 

 

Hope I was able to help you.

 

Nikolino

I know I don't know anything (Socrates)

 

* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here

 

@Nikolino Thanks, I'll take a look at that.