Help With a VBA Code

Falcons88

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

I have the current code in place which does work but I need it to do something on top of this, I want it to copy the same information all at once M-T but each line from 9 down to 15 only if there is data in column L, so for example below the code I want to copy over all at once lines 9 & 10 only as 11-15 are blank :

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

1626077626732.png
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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