Copying lines individually to relevant tables

Falcons88

New Member
Joined
Jun 10, 2021
Messages
24
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have nearly finished a document I have created but have a few finishing touches I need help on, below I have an input sheet where I have invoices to input, I am trying to get each row to separately go into the relevant table, it works with the code below but I'm wanting the code to be relevant to lines 9-15, in the below example only 9 & 10 are copied over to the relevant tables as 11-15 are blank but the code I have will only copy line 9:

1626959920745.png


Dim ary As Variant, n As Variant

'Names of accounts from 1 to 19
ary = Array("Revenue", "Direct Costs", "Overhead", "Fixed Asset", "Current Asset", "Current Liability", _
"Non-Current Liability", "Equity", "VAT", "Tracking", "Accounts Payable", "Unpaid Expense Claims", _
"Bank Revaluations", "Unrealised Currency Gains", "Realised Currency Gains", "Accounts Receivable", _
"Inventory", "Historical", "Rounding", "Retained Earnings")
If Not IsError(n) Then
n = Application.Match(Sheets("Input Sheet").Range("L9").Value, ary, 0)
With Sheets("Chart of Accounts").ListObjects("Table" & n).ListRows.Add.Range 'add a new row and get its Range
.Cells(1).Resize(1, 5).Value = Application.Index(Sheets("Input Sheet").Range("M9:T9").Value, 1, Array(1, 2, 3, 4, 5, 6, 7, 8))
End With
 

Attachments

  • 1626959714079.png
    1626959714079.png
    14 KB · Views: 5
  • 1626959790775.png
    1626959790775.png
    46.6 KB · Views: 7

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,223,911
Messages
6,175,334
Members
452,636
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top