Forum Discussion

Archangelz93's avatar
Archangelz93
Copper Contributor
Jun 02, 2019
Solved

Try to copy number from one table to another

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.

  • 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

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

2 Replies

  • 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

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

    • Archangelz93's avatar
      Archangelz93
      Copper Contributor
      Hi,

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

      Wish you the best :)