HI,
found the code below but only copy and paste the firs row and if I run again give run time error 9 subscript out of range.
code:
Here is the data copy from but only pasting this row:
Thank you
found the code below but only copy and paste the firs row and if I run again give run time error 9 subscript out of range.
code:
VBA Code:
Sub Copyfrom_Workbook_Another()
Dim x As Workbook
Dim y As Workbook
Dim vals As Variant
'## Open both workbooks first:
Set x = Workbooks.Open("C:\Users\jose.rossi\Desktop\Excel Files\DCL_CAB INVOICES_BELL\2023 Bell CABS Payments.xlsm ")
Set y = Workbooks.Open("C:\Users\jose.rossi\Desktop\Excel Files\DCL_CAB INVOICES_BELL\X CTRX ON SAGE300 IMPORT FILE.xls ")
'Store the value in a variable:
vals = x.Sheets("Ctrx ON Mar").Range("A27").Value
'Use the variable to assign a value to the other file/sheet:
y.Sheets("Invoice_Details").Range("G2").Value = vals
'Close x:
'x.Close
End Sub
Here is the data copy from but only pasting this row:
519 376 4157-MAR23 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
A27 | A27 | =M7 |
B27,B29,B31,B33,B35,B37,B39,B41,B43,B45,B47,B49,B51,B53 | B27 | =$H$3 |
C27 | C27 | =H7 |
A28,A30,A32,A34,A36,A38,A40,A42,A44,A46,A48,A50,A52,A54 | A28 | =A27 |
B28,B30,B32,B34,B36,B38,B40,B42,B44,B46,B48,B50,B52,B54 | B28 | =$I$3 |
C28 | C28 | =I7 |
A29 | A29 | =M8 |
C29 | C29 | =H8 |
C30 | C30 | =I8 |
A31 | A31 | =M9 |
C31 | C31 | =H9 |
C32 | C32 | =I9 |
A33 | A33 | =M10 |
C33 | C33 | =H10 |
C34 | C34 | =I10 |
A35 | A35 | =M11 |
C35 | C35 | =H11 |
C36 | C36 | =I11 |
A37 | A37 | =M12 |
C37 | C37 | =H12 |
C38 | C38 | =I12 |
A39 | A39 | =M13 |
C39 | C39 | =H13 |
C40 | C40 | =I13 |
A41 | A41 | =M14 |
C41 | C41 | =H14 |
C42 | C42 | =I14 |
A43 | A43 | =M15 |
C43 | C43 | =H15 |
C44 | C44 | =I15 |
A45 | A45 | =M16 |
C45 | C45 | =H16 |
C46 | C46 | =I16 |
A47 | A47 | =M17 |
C47 | C47 | =H17 |
C48 | C48 | =I17 |
A49 | A49 | =M18 |
C49 | C49 | =H18 |
C50 | C50 | =I18 |
A51 | A51 | =M19 |
C51 | C51 | =H19 |
C52 | C52 | =I19 |
A53 | A53 | =M20 |
C53 | C53 | =H20 |
C54 | C54 | =I20 |
E27 | E27 | =D7*$H$4 |
E28 | E28 | =D7-E27 |
E29 | E29 | =D8*$H$4 |
E30 | E30 | =D8-E29 |
E31 | E31 | =D9*$H$4 |
E32 | E32 | =D9-E31 |
E33 | E33 | =D10*$H$4 |
E34 | E34 | =D10-E33 |
E35 | E35 | =D11*$H$4 |
E36 | E36 | =D11-E35 |
E37 | E37 | =D12*$H$4 |
E38 | E38 | =D12-E37 |
E39 | E39 | =D13*$H$4 |
E40 | E40 | =D13-E39 |
E41 | E41 | =D14*$H$4 |
E42 | E42 | =D14-E41 |
E43 | E43 | =D15*$H$4 |
E44 | E44 | =D15-E43 |
E45 | E45 | =D16*$H$4 |
E46 | E46 | =D16-E45 |
E47 | E47 | =D17*$H$4 |
E48 | E48 | =D17-E47 |
E49 | E49 | =D18*$H$4 |
E50 | E50 | =D18-E49 |
E51 | E51 | =D19*$H$4 |
E52 | E52 | =D19-E51 |
E53 | E53 | =D20*$H$4 |
E54 | E54 | =D20-E53 |
Thank you