title: Excel VBA - Sum all accesses and users from different worksheets into new worksheet
body: <p>I have the following worksheets</p>
  
  <p><strong>Users from XXX</strong></p>
  
  <pre><code>Users    Access
  Foo      30
  Bar      45 
  </code></pre>
  
  <p><strong>Users from YYY</strong></p>
  
  <pre><code>Users    Access
  Beef     90
  Foo      85
  </code></pre>
  
  <p><strong>Sums of accesses</strong></p>
  
  <pre><code>Users    Access
  </code></pre>
  
  <p>If the users from the <strong>XXX</strong> table match with the ones in the <strong>YYY</strong> table then I want to append the User and the <strong>sum</strong> of accesses from both worksheets into the <strong>Sums of accesses</strong> one</p>
  
  <p>So far I've come up with</p>
  
  <pre><code>Sub CalcularSoma()
    Dim sh1 As Worksheet, sh2 As Worksheet, sh3 As Worksheet, r_users_a As Range, r_acessos_a As Range, r_users_b As Range, r_acessos_b As Range
    Set sh1 = Worksheets("Users XXX")
    Set sh2 = Worksheets("Users YYY")
    Set sh3 = Worksheets("Sum of all")
  
    Set r_users_a = sh1.Range("A2")
    Set r_acess_a = sh1.Range("B2")
  
    Set r_users_b = sh2.Range("A2")
    Set r_acess_b = sh2.Range("B2")
  
  End Sub
  </code></pre>
  
  <p>But I can't get my head around on how I would loop through each and then append</p>