SOLVED
Home

I want to enter data in one sheet and have it be copied to other sheets based on a column

%3CLINGO-SUB%20id%3D%22lingo-sub-844141%22%20slang%3D%22en-US%22%3EI%20want%20to%20enter%20data%20in%20one%20sheet%20and%20have%20it%20be%20copied%20to%20other%20sheets%20based%20on%20a%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-844141%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20the%20Main%20sheet%20where%20I%20want%20to%20input%20any%20new%20orders%20and%20I%20have%20other%20sheets%20where%20the%20orders%20get%20filtered%20down%20depending%20on%20one%20criterion.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20other%20sheet%20records%20the%20orders%20and%20keeps%20track%20of%20how%20much%20supply%20I%20have%20left.%20So%20it%20is%20essential%20that%20I%20can%20copy%20over%20at%20least%20the%20number%20that%20has%20been%20used%20up%20in%20the%20other%20sheets.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20been%20unable%20to%20find%20an%20automated%20way%20of%20doing%20this%20and%20have%20been%20trying%20to%20tackle%20this%20for%20a%20while%20now.%20I%20only%20want%20one%20column%20copied%20over%20(to%20make%20everything%20simpler%2C%20but%20wouldn't%20mind%20the%20whole%20row%20if%20that%20is%20possible).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20attached%20an%20example%20excel%20file.%20Any%20help%20would%20be%20greatly%20appreciated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20Advance.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-844141%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-844219%22%20slang%3D%22en-US%22%3ERe%3A%20I%20want%20to%20enter%20data%20in%20one%20sheet%20and%20have%20it%20be%20copied%20to%20other%20sheets%20based%20on%20a%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-844219%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F405819%22%20target%3D%22_blank%22%3E%40saramabbas%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20think%20you%20need%20to%20rephrase%20your%20requirement%20as%20it%20is%20not%20clear%20what%20you%20need%20to%20copy%20over%20to%20other%20sheets%20and%20where%20exactly.%3C%2FP%3E%3CP%3EWhy%20not%20explain%20the%20logic%20taking%20one%20row%20as%20an%20example%3F%3C%2FP%3E%3CP%3Ee.g.%20lets%20assume%20you%20enter%20data%20in%20row%2332%20as%20per%20the%20existing%20data%20in%20your%20sample%20file%2C%20what%20do%20you%20want%20to%20do%20next%3F%20Please%20explain%20all%20the%20manual%20steps%20which%20you%20would%20take%20to%20achieve%20the%20desired%20output%20which%20would%20be%20copying%20some%20data%20from%20Main%20sheet%20to%20the%20Kiera%20Pewter%20Sheet%20and%20the%20question%20here%20is%20what%20to%20copy%20from%20Main%20Sheet%20and%20paste%20where%20on%20Kiera%20Pewter%20Sheet%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-844313%22%20slang%3D%22en-US%22%3ERe%3A%20I%20want%20to%20enter%20data%20in%20one%20sheet%20and%20have%20it%20be%20copied%20to%20other%20sheets%20based%20on%20a%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-844313%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F394231%22%20target%3D%22_blank%22%3E%40Subodh_Tiwari_sktneer%3C%2FA%3E%26nbsp%3BThanks%20for%20taking%20the%20time%20to%20read%20all%20that.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFrom%20the%20main%20sheet%2C%20I%20want%20the%20cell%20F32%20to%20go%20into%20cell%20B11%20on%20the%20sheet%20called%20'Kiera%20Pewter'.%20I%20also%20want%20excel%20to%20choose%20which%20sheet%20to%20copy%20the%20cell%20in%20based%20on%20what%20it%20finds%20in%20the%20cell%20D32.%20Eg.%20it%20said%20'Kiera%20Pewter'%20so%20it%20should%20choose%20the%20sheet%20called%20'Kiera%20Pewter'%20and%20then%20copy%20it%20in%20there.%20If%20it%20was%20that%20it%20said%20'Kiera%20Cream'%20as%20it%20does%20in%20D31%2C%20I%20want%20it%20to%20copy%20the%20'Total%20Fabric%20required'%20value%20into%20B11%20in%20the%20sheet%20titled%20'Kiera%20Cream'.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20hope%20that%20answers%20your%20question.%20Thanks%20again.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-844372%22%20slang%3D%22en-US%22%3ERe%3A%20I%20want%20to%20enter%20data%20in%20one%20sheet%20and%20have%20it%20be%20copied%20to%20other%20sheets%20based%20on%20a%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-844372%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F405819%22%20target%3D%22_blank%22%3E%40saramabbas%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20find%20the%20attached%20with%20a%20Sheet%20Change%20Event%20code%20on%20the%20Main%20Sheet%20Module.%3C%2FP%3E%3CP%3ETo%20view%20the%20code%2C%20right%20click%20on%20Main%20Sheet%20Tab%20--%26gt%3B%20View%20code.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20per%20the%20code%20once%20you%20input%20a%20value%20in%20any%20row%20in%20column%20E%2C%20the%20code%20will%20first%20check%20if%20the%20columns%20A%3AD%20for%20that%20row%20are%20filled%2C%20if%20so%2C%20the%20code%20will%20copy%20the%20value%20from%20column%20F%20from%20that%20row%20to%20the%20sheet%20which%20is%20mentioned%20in%20column%20D.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20is%20the%20Change%20Event%20Code%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EPrivate%20Sub%20Worksheet_Change(ByVal%20Target%20As%20Range)%0AIf%20Target.CountLarge%20%26gt%3B%201%20Then%20Exit%20Sub%0ADim%20ws%20As%20Worksheet%0ADim%20cntFilled%20As%20Long%0ADim%20r%20As%20Long%0AIf%20Target.Column%20%3D%205%20And%20Target.Row%20%26gt%3B%203%20Then%0A%20%20%20%20If%20Target%20%26lt%3B%26gt%3B%20%22%22%20Then%0A%20%20%20%20%20%20%20%20Application.EnableEvents%20%3D%20False%0A%20%20%20%20%20%20%20%20r%20%3D%20Target.Row%0A%20%20%20%20%20%20%20%20cntFilled%20%3D%20Application.CountA(Range(%22A%22%20%26amp%3B%20r%20%26amp%3B%20%22%3AD%22%20%26amp%3B%20r))%0A%20%20%20%20%20%20%20%20If%20cntFilled%20%26lt%3B%26gt%3B%204%20Then%0A%20%20%20%20%20%20%20%20%20%20%20%20MsgBox%20%22Please%20fill%20all%20the%20cells%20in%20the%20range%20%22%20%26amp%3B%20Range(%22A%22%20%26amp%3B%20r%20%26amp%3B%20%22%3AD%22%20%26amp%3B%20r).Address(0%2C%200)%20%26amp%3B%20%22%20first%20and%20then%20try%20again...%22%2C%20vbExclamation%0A%20%20%20%20%20%20%20%20%20%20%20%20Application.Undo%0A%20%20%20%20%20%20%20%20%20%20%20%20GoTo%20Skip%0A%20%20%20%20%20%20%20%20End%20If%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20On%20Error%20Resume%20Next%0A%20%20%20%20%20%20%20%20Set%20ws%20%3D%20Worksheets(Range(%22D%22%20%26amp%3B%20r).Value)%0A%20%20%20%20%20%20%20%20On%20Error%20GoTo%200%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20If%20ws%20Is%20Nothing%20Then%0A%20%20%20%20%20%20%20%20%20%20%20%20MsgBox%20%22The%20Sheet%20called%20'%22%20%26amp%3B%20Range(%22D%22%20%26amp%3B%20r).Value%20%26amp%3B%20%22'%20doesn't%20exists%20in%20this%20Workbook.%22%20%26amp%3B%20_%0A%20%20%20%20%20%20%20%20%20%20%20%20%22%20Please%20insert%20a%20Sheet%20First%20and%20then%20try%20again...%22%2C%20vbExclamation%0A%20%20%20%20%20%20%20%20%20%20%20%20GoTo%20Skip%0A%20%20%20%20%20%20%20%20End%20If%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20ws.Range(%22B%22%20%26amp%3B%20Rows.Count).End(3)(2).Value%20%3D%20Range(%22F%22%20%26amp%3B%20r).Value%0A%20%20%20%20%20%20%20%20Range(%22G%22%20%26amp%3B%20r).Value%20%3D%20%22Transferred%22%0A%20%20%20%20End%20If%0AEnd%20If%0ASkip%3A%0AApplication.EnableEvents%20%3D%20True%0AEnd%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELet%20me%20know%20if%20that%20is%20what%20you%20were%20trying%20to%20achieve.%3C%2FP%3E%3CP%3EIf%20that%20takes%20care%20of%20your%20original%20question%2C%20please%20accept%20this%20post%20as%20an%20Answer%20to%20mark%20your%20question%20as%20Solved%20and%20give%20a%20like%20to%20the%20post%20if%20you%20wish.%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
saramabbas
New Contributor

I have the Main sheet where I want to input any new orders and I have other sheets where the orders get filtered down depending on one criterion. 

 

The other sheet records the orders and keeps track of how much supply I have left. So it is essential that I can copy over at least the number that has been used up in the other sheets. 

 

I have been unable to find an automated way of doing this and have been trying to tackle this for a while now. I only want one column copied over (to make everything simpler, but wouldn't mind the whole row if that is possible).

 

I have attached an example excel file. Any help would be greatly appreciated.

 

Thanks in Advance.

3 Replies

@saramabbas 

I think you need to rephrase your requirement as it is not clear what you need to copy over to other sheets and where exactly.

Why not explain the logic taking one row as an example?

e.g. lets assume you enter data in row#32 as per the existing data in your sample file, what do you want to do next? Please explain all the manual steps which you would take to achieve the desired output which would be copying some data from Main sheet to the Kiera Pewter Sheet and the question here is what to copy from Main Sheet and paste where on Kiera Pewter Sheet?

 

@Subodh_Tiwari_sktneer Thanks for taking the time to read all that. 

 

From the main sheet, I want the cell F32 to go into cell B11 on the sheet called 'Kiera Pewter'. I also want excel to choose which sheet to copy the cell in based on what it finds in the cell D32. Eg. it said 'Kiera Pewter' so it should choose the sheet called 'Kiera Pewter' and then copy it in there. If it was that it said 'Kiera Cream' as it does in D31, I want it to copy the 'Total Fabric required' value into B11 in the sheet titled 'Kiera Cream'. 

 

I hope that answers your question. Thanks again. 

Highlighted
Solution

@saramabbas 

Please find the attached with a Sheet Change Event code on the Main Sheet Module.

To view the code, right click on Main Sheet Tab --> View code.

 

As per the code once you input a value in any row in column E, the code will first check if the columns A:D for that row are filled, if so, the code will copy the value from column F from that row to the sheet which is mentioned in column D.

 

Here is the Change Event Code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
Dim ws As Worksheet
Dim cntFilled As Long
Dim r As Long
If Target.Column = 5 And Target.Row > 3 Then
    If Target <> "" Then
        Application.EnableEvents = False
        r = Target.Row
        cntFilled = Application.CountA(Range("A" & r & ":D" & r))
        If cntFilled <> 4 Then
            MsgBox "Please fill all the cells in the range " & Range("A" & r & ":D" & r).Address(0, 0) & " first and then try again...", vbExclamation
            Application.Undo
            GoTo Skip
        End If
        
        On Error Resume Next
        Set ws = Worksheets(Range("D" & r).Value)
        On Error GoTo 0
        
        If ws Is Nothing Then
            MsgBox "The Sheet called '" & Range("D" & r).Value & "' doesn't exists in this Workbook." & _
            " Please insert a Sheet First and then try again...", vbExclamation
            GoTo Skip
        End If
        
        ws.Range("B" & Rows.Count).End(3)(2).Value = Range("F" & r).Value
        Range("G" & r).Value = "Transferred"
    End If
End If
Skip:
Application.EnableEvents = True
End Sub

 

Let me know if that is what you were trying to achieve.

If that takes care of your original question, please accept this post as an Answer to mark your question as Solved and give a like to the post if you wish.

 

 

 

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
30 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies