Excel Sales Calculator - VBA||Sales Calculator in Excel using Macro||EXCEL VBA- TUTORIAL|| Excel VBA

Опубликовано: 10 Март 2025
на канале: CT TUTORIAL
474
5

#CTTUTORIAL
Excel Sales Calculator - VBA||Sales Calculator in Excel using Macro.

we will look at a program in Excel VBA that calculates the total sales of each employee over a period of three years.

Sales Calculator in Excel using Macro. Create Sales Calculator very easyly.How to analysis your data easily . We can this analysis from excel but if we will use Macro, we can easily analysis . If you want to learn this please see this video Sales Calculator in Excel using Macro.

CODE:

Sub Sales_Calculator()
'VBA Compile Error: Statement invalid outside Type Block

Dim Country As String, total As Integer, sheet As Worksheet

Dim i As Integer

total = 0
'Taking User Input
Country = InputBox("Please enter the Country name(Case Sensitive)")

'For Checking Every sheet and 2nd loop for checking every month
For Each sheet In Worksheets
For i = 2 To 13
If sheet.Cells(i, 2) = Country Then
total = total + sheet.Cells(i, 3).Value
End If
Next i
Next sheet

MsgBox "Total Sales of " & Country & " is: " & total

End Sub