Have 3 worksheets in my invoice program:
1 sheet with the name "Invoice CT ENG Blanco"
1 sheet with the name "Invoice CT ENG"
1 sheet with the name "Invoice Records"
Sheets "Invoice CT ENG Blanco" and "Invoice CT ENG" have different cells what I want to save to my sheet "Invoice Records"
The layout of my sheet "Invoice Records" have standard collums where I will put the data in from one of the invoice-sheets.
When I make an invoice I choose in which sheet I will make my invoice. ("Invoice CT ENG Blanco" OR "Invoice CT ENG")
So in my example I have fill in both sheets "Invoice CT ENG Blanco" and "Invoice CT ENG" with some data, but when I save this with a VB code it go's wrong...
The code must save the cells of the worksheet where I standing on. So I first choose which worksheet I want to use and the program looks which worksheet is filled in and save the cells of that worksheet in my "Invoice Records" worksheet.
But the sheets have different cell numbers what I want to save so thats also a problem how I can arranged that.
This my code what I have found on this forum and have try to work out for mine question so far. The first loop for the sheet "Invoice CT ENG Blanco" works fine, but the loop of the sheet "Invoice CT ENG" go's wrong.
Sub Invoice_Records_from_all_worksheets()
Dim i As Integer
Dim c As Range
'Dim a As Integer
Dim a As Range
With Sheets("Invoice Records")
Set c = .Cells(.Rows.Count, 1).End(xlUp).Offset(1)
End With
With Sheets("Invoice CT ENG Blanco")
For i = 1 To 7 'Loops 7 times. Change the 7 to match the number of your cells to copy
'Take the following cells from worksheet "Invoice CT ENG Blanco" and put it on worksheet "Invoice_Records"
c.Offset(, i - 1).Value = .Range(Choose(i, "X15", "W14", "X17", "U47", "B13", "W16", "B5")).Value
Next i
With Sheets("Invoice CT ENG")
For i = 1 To 6 'Loops 6 times. Change the 6 to match the number of your cells to copy
'Take the following cells from worksheet "Invoice CT ENG" and put it on worksheet "Invoice_Records"
c.Offset(, i - 1).Value = .Range(Choose(i, "", "X15", "W14", "W17", "U40", "B5")).Value
Next i
End With
End With
End Sub
So thats what I have. I don't know where I can upload my exel example.?
Waiting of help with my question.
Thanks.
1 sheet with the name "Invoice CT ENG Blanco"
1 sheet with the name "Invoice CT ENG"
1 sheet with the name "Invoice Records"
Sheets "Invoice CT ENG Blanco" and "Invoice CT ENG" have different cells what I want to save to my sheet "Invoice Records"
The layout of my sheet "Invoice Records" have standard collums where I will put the data in from one of the invoice-sheets.
When I make an invoice I choose in which sheet I will make my invoice. ("Invoice CT ENG Blanco" OR "Invoice CT ENG")
So in my example I have fill in both sheets "Invoice CT ENG Blanco" and "Invoice CT ENG" with some data, but when I save this with a VB code it go's wrong...
The code must save the cells of the worksheet where I standing on. So I first choose which worksheet I want to use and the program looks which worksheet is filled in and save the cells of that worksheet in my "Invoice Records" worksheet.
But the sheets have different cell numbers what I want to save so thats also a problem how I can arranged that.
This my code what I have found on this forum and have try to work out for mine question so far. The first loop for the sheet "Invoice CT ENG Blanco" works fine, but the loop of the sheet "Invoice CT ENG" go's wrong.
Sub Invoice_Records_from_all_worksheets()
Dim i As Integer
Dim c As Range
'Dim a As Integer
Dim a As Range
With Sheets("Invoice Records")
Set c = .Cells(.Rows.Count, 1).End(xlUp).Offset(1)
End With
With Sheets("Invoice CT ENG Blanco")
For i = 1 To 7 'Loops 7 times. Change the 7 to match the number of your cells to copy
'Take the following cells from worksheet "Invoice CT ENG Blanco" and put it on worksheet "Invoice_Records"
c.Offset(, i - 1).Value = .Range(Choose(i, "X15", "W14", "X17", "U47", "B13", "W16", "B5")).Value
Next i
With Sheets("Invoice CT ENG")
For i = 1 To 6 'Loops 6 times. Change the 6 to match the number of your cells to copy
'Take the following cells from worksheet "Invoice CT ENG" and put it on worksheet "Invoice_Records"
c.Offset(, i - 1).Value = .Range(Choose(i, "", "X15", "W14", "W17", "U40", "B5")).Value
Next i
End With
End With
End Sub
So thats what I have. I don't know where I can upload my exel example.?
Waiting of help with my question.
Thanks.
Last edited: