SOLVED
Home

Try to copy number from one table to another

%3CLINGO-SUB%20id%3D%22lingo-sub-663187%22%20slang%3D%22en-US%22%3ETry%20to%20copy%20number%20from%20one%20table%20to%20another%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-663187%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3EI%20am%20quite%20new%20to%20Excel.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20currently%20in%20the%20progress%20of%20making%20an%20encounter%20list%20with%20the%20help%20of%20Excel.%3C%2FP%3E%3CP%3EWhat%20I%20want%20to%20do%20is%20the%20following%3A%3CBR%20%2F%3ESheet%201%20(named%20Encounter)%20has%20a%20table%20named%20%22main_encounter%22%20which%20contains%20rows%20containin%20the%20stats%20of%20these%20encounters.%3CBR%20%2F%3E%3CBR%20%2F%3ESheet%202%20has%20a%20table%20named%20%22stat_list%22%20which%20contains%20stats%20for%20some%20of%20the%20encounters%20in%20this%20D%26amp%3BD%20homebrew%20version%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%22main_encounter%22%20tabl%2C%20A2%2C%20has%20a%20list%20containing%20all%20the%20encounters%2C%20and%20I%20want%2C%20depending%20on%20what%20is%20picked%2C%20to%20show%20the%20corresponding%20stats%20that%20%22stat_list%22%20have%20for%20the%20various%20creatures.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20this%20be%20done%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20you%20want%20to%20have%20a%20look%20at%20it%20I%20have%20attached%20the%20file%20here%20as%20well.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20taking%20your%20time%20with%20my%20humble%20request%20for%20aid.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-663187%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-663202%22%20slang%3D%22en-US%22%3ERe%3A%20Try%20to%20copy%20number%20from%20one%20table%20to%20another%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-663202%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F353250%22%20target%3D%22_blank%22%3E%40Archangelz93%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ehi%2C%20try%20this%20event%20behind%20Tabelle1%2C%20see%20attached%20file%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3EPrivate%20Sub%20Worksheet_Change(ByVal%20Target%20As%20Range)%3CBR%20%2F%3EDim%20rngFind%20As%20Range%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20Target.Address(False%2C%20False)%20%3D%20%22A2%22%20Then%3CBR%20%2F%3ESet%20rngFind%20%3D%20Tabelle2.Range(%22C%3AC%22).Find(what%3A%3DTarget.Value%2C%20lookat%3A%3DxlWhole)%3CBR%20%2F%3E%3CBR%20%2F%3EWith%20Tabelle2%3CBR%20%2F%3EIf%20Not%20rngFind%20Is%20Nothing%20Then%3CBR%20%2F%3E.Range(.Cells(rngFind.Row%2C%20%22D%22)%2C%20.Cells(rngFind.Row%2C%20%22J%22)).Copy%20Destination%3A%3DCells(Target.Row%2C%20%22B%22)%3CBR%20%2F%3EEnd%20If%3CBR%20%2F%3EEnd%20With%3CBR%20%2F%3E%3CBR%20%2F%3EEnd%20If%3CBR%20%2F%3EEnd%20Sub%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20regards%20from%20germany%3C%2FP%3E%3CP%3EBernd%3C%2FP%3E%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fwww.vba-tanker.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ewww.vba-tanker.com%3C%2FA%3E%20-%20a%20database%20full%20of%20excel-macros%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-663269%22%20slang%3D%22en-US%22%3ERe%3A%20Try%20to%20copy%20number%20from%20one%20table%20to%20another%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-663269%22%20slang%3D%22en-US%22%3EHi%2C%3CBR%20%2F%3E%3CBR%20%2F%3EThank%20you%2C%20this%20was%20exactly%20what%20I%20was%20looking%20for!%3CBR%20%2F%3E%3CBR%20%2F%3EWish%20you%20the%20best%20%3A)%3C%2FLINGO-BODY%3E
Archangelz93
New Contributor

Hello,

I am quite new to Excel.

 

I am currently in the progress of making an encounter list with the help of Excel.

What I want to do is the following:
Sheet 1 (named Encounter) has a table named "main_encounter" which contains rows containin the stats of these encounters.

Sheet 2 has a table named "stat_list" which contains stats for some of the encounters in this D&D homebrew version

 

"main_encounter" tabl, A2, has a list containing all the encounters, and I want, depending on what is picked, to show the corresponding stats that "stat_list" have for the various creatures.

 

Can this be done?

 

 

If you want to have a look at it I have attached the file here as well.

 

Thank you for taking your time with my humble request for aid.

2 Replies
Highlighted
Solution

@Archangelz93 

hi, try this event behind Tabelle1, see attached file

 

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngFind As Range

If Target.Address(False, False) = "A2" Then
Set rngFind = Tabelle2.Range("C:C").Find(what:=Target.Value, lookat:=xlWhole)

With Tabelle2
If Not rngFind Is Nothing Then
.Range(.Cells(rngFind.Row, "D"), .Cells(rngFind.Row, "J")).Copy Destination:=Cells(Target.Row, "B")
End If
End With

End If
End Sub

 

Best regards from germany

Bernd

www.vba-tanker.com - a database full of excel-macros

Hi,

Thank you, this was exactly what I was looking for!

Wish you the best :)
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