Alex Piotto
Board Regular
- Joined
- Jul 5, 2016
- Messages
- 82
- Office Version
- 2007
- Platform
- Windows
Hi everybody!
Has been a while... got seek, got well, got lucky!
Now...
I have two sheets, named VENDAS and RESUMO.
From VENDAS i am copying two cells, named DATAVENDA and TOTAL.
The 2 cells are not near each other. DATAVENDA is near the top and TOTAL is almost at the end of the sheet. In different columns.
I put a button in the VENDAS sheet. The code of the button is:
---------
Private Sub CommandButton1_Click()
Dim rng As Range
Set rng = Sheets("VENDAS").Range("DATAVENDA, TOTAL")
For Each cell In rng
Sheets("RESUMO").Cells(cell.Row, cell.Column).Value = cell.Value
Next cell
End Sub
---------
I am able to copy the 2 values to the RESUMO sheet, but i need the two values to be in the same row, starting from row 8.
And next time i click the button it should add one new row with the new values, one row below. Every time. To build a list.
Now the values are pasted in the same cells where i copied, one near the top, one near the bottom of VENDAS sheet.
And when i click again the button it will over-wright the values... So...
How do i position the values in the right place to begin with, and how do i add a new row with new values below next time i click the button?
Any help will be fantastic! Thanks
Has been a while... got seek, got well, got lucky!
Now...
I have two sheets, named VENDAS and RESUMO.
From VENDAS i am copying two cells, named DATAVENDA and TOTAL.
The 2 cells are not near each other. DATAVENDA is near the top and TOTAL is almost at the end of the sheet. In different columns.
I put a button in the VENDAS sheet. The code of the button is:
---------
Private Sub CommandButton1_Click()
Dim rng As Range
Set rng = Sheets("VENDAS").Range("DATAVENDA, TOTAL")
For Each cell In rng
Sheets("RESUMO").Cells(cell.Row, cell.Column).Value = cell.Value
Next cell
End Sub
---------
I am able to copy the 2 values to the RESUMO sheet, but i need the two values to be in the same row, starting from row 8.
And next time i click the button it should add one new row with the new values, one row below. Every time. To build a list.
Now the values are pasted in the same cells where i copied, one near the top, one near the bottom of VENDAS sheet.
And when i click again the button it will over-wright the values... So...
How do i position the values in the right place to begin with, and how do i add a new row with new values below next time i click the button?
Any help will be fantastic! Thanks