Oberon70
Board Regular
- Joined
- Jan 21, 2022
- Messages
- 160
- Office Version
- 365
- Platform
- Windows
Hi,
I have a lot of help and recommendations on arrays, so I decided to try to learn the basic 2 dimensional array 1st.
I am taking information that is span across two worksheets in the same workbook
But I am getting an error
Is something able to advise me what I am doing wrong? that is causing the above error.
I thought maybe it is because the source data is on a merged cell example ='Tax Invoice'!I32:K32, but I tried replacing K35 above with I32:K32, but received the same error.
I have a lot of help and recommendations on arrays, so I decided to try to learn the basic 2 dimensional array 1st.
I am taking information that is span across two worksheets in the same workbook
VBA Code:
Sub AddInvDetails()
Dim InvArray(1 To 9, 1 To 2)
InvArray(1, 1) = "Invoice Date"
InvArray(1, 2) = SrcData.Range("C3") 'Invoice Date
InvArray(2, 1) = "Recovery Agent"
InvArray(2, 2) = SrcData.Range("C9") 'Name of Agent
InvArray(3, 1) = "Portfolio Code"
InvArray(3, 2) = SrcData.Range("C30") 'Portfolio Code
InvArray(4, 1) = "Invoice Number"
InvArray(4, 2) = SrcData.Range("C37") 'Invoice Number
InvArray(5, 1) = "Total Gross Amount"
InvArray(5, 2) = SrcTaxInvoice.Range("K35") 'Total Gross Amount
InvArray(6, 1) = "Net Commission"
InvArray(6, 2) = SrcTaxInvoice.Range("X30") ' Net Commission
InvArray(7, 1) = "GST Amount"
InvArray(1, 7) = SrcTaxInvoice.Range("X33") ' GST Amount
InvArray(8, 1) = "Gross Commission"
InvArray(1, 8) = SrcTaxInvoice.Range("AA34") 'Gross Commission
InvArray(9, 1) = "Net Amount"
InvArray(1, 9) = SrcTaxInvoice.Range("AA34") 'Net Amount paid
End Sub
But I am getting an error
Is something able to advise me what I am doing wrong? that is causing the above error.
I thought maybe it is because the source data is on a merged cell example ='Tax Invoice'!I32:K32, but I tried replacing K35 above with I32:K32, but received the same error.