HomeMicrosoft OfficeExcelMod Operator in Excel VBA

Mod Operator in Excel VBA

In this post, you’ll learn about the Mod operator and how to use Mod operator to solve mathematical problems spreadsheets using Excel VBA.   

Mod Operator

The MOD function returns the remainder of the divided numbers.

Sample program using Mod operator in Excel VBA.

  • First, place a command button on your worksheet.
  • Add the following code to the button.

Code:

Private Sub CommandButton1_Click()

  Dim Result As Integer

  Result = 57 Mod 12

  MsgBox Result
	
End Sub

Now run the code or click the command button. The result gets displayed.

Leave a Reply

You May Also Like

In this article, you will learn about the SKEW.P function, the formula syntax and usage of the function in Microsoft...
In this article, you will learn about the SKEW function, the formula syntax and usage of the function in Microsoft...
In this article, you will learn about the RANK.EQ function, the formula syntax and usage of the function in Microsoft...
  • Excel
  • November 23, 2021