Is it possible without VBA?

Alex Piotto

Board Regular
Joined
Jul 5, 2016
Messages
82
Office Version
  1. 2007
Platform
  1. 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.

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?
 
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.

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?

On sheet RESUMO, in column A, you could put the formula
=DATAVENDA, perhaps array entered on a range of cells.
and immediately below that, the formula =SUBSORVETES
and then =SUBMASSAS, etc.

When you would have presed the button, copy the formulas paste them (as formulas) immediatly below themselves and then copy/paste values the original range.
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Technically it is possible without VBA per se, but you would need some sort of macro (XLM or perhaps office script).
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,332
Members
449,077
Latest member
jmsotelo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top