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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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