Alex Piotto
Board Regular
- Joined
- Jul 5, 2016
- Messages
- 82
- Office Version
- 2007
- Platform
- Windows
Hi.
Just out of curiosity, but also good for learning...
I have two sheets, VENDAS and RESUMO.
Inside VENDAS I have a few NAMED cells, with some text and numbers inside.
Values of NAMED cells will change overtime, so I made a button and a script.
With this script I send the NAMED cells values into RESUMO sheet, one row at a time, every time I click the Button.
Everything works fine.
What I am asking is: It is possible to achieve the same without VBA?
Just out of curiosity, but also good for learning...
I have two sheets, VENDAS and RESUMO.
Inside VENDAS I have a few NAMED cells, with some text and numbers inside.
Values of NAMED cells will change overtime, so I made a button and a script.
With this script I send the NAMED cells values into RESUMO sheet, one row at a time, every time I click the Button.
VBA Code:
Private Sub CommandButton1_Click()
lastRow = Sheets("RESUMO").Cells(Rows.Count, "A").End(xlUp).Row
ThisWorkbook.Sheets("VENDAS").Range("DATAVENDA").Copy
ThisWorkbook.Sheets("RESUMO").Range("A" & lastRow + 1).PasteSpecial Paste:=xlPasteValues
ThisWorkbook.Sheets("VENDAS").Range("SUBSORVETES").Copy
ThisWorkbook.Sheets("RESUMO").Range("B" & lastRow + 1).PasteSpecial Paste:=xlPasteValues
ThisWorkbook.Sheets("VENDAS").Range("SUBMASSAS").Copy
ThisWorkbook.Sheets("RESUMO").Range("C" & lastRow + 1).PasteSpecial Paste:=xlPasteValues
ThisWorkbook.Sheets("VENDAS").Range("SUBPADARIA").Copy
ThisWorkbook.Sheets("RESUMO").Range("D" & lastRow + 1).PasteSpecial Paste:=xlPasteValues
ThisWorkbook.Sheets("VENDAS").Range("SUBPASTELARIA").Copy
ThisWorkbook.Sheets("RESUMO").Range("E" & lastRow + 1).PasteSpecial Paste:=xlPasteValues
ThisWorkbook.Sheets("VENDAS").Range("TOTAL").Copy
ThisWorkbook.Sheets("RESUMO").Range("F" & lastRow + 1).PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
Sheets("RESUMO").Activate
Sheets("RESUMO").Range("B1").Select
End Sub
Everything works fine.
What I am asking is: It is possible to achieve the same without VBA?