Saturday 17 May 2014

Excel macro program to find the factorial of a number factorial using macro vba excel program for factorial

Program

Sub Button5_Click()
Dim num, i, fact As Double
num = InputBox("enter number")
fact = 1
For i = 1 To num
fact = fact * i
Next i
MsgBox ("The factorial is " & fact)

End Sub

excel macro to create multiplication table excel vba program to create multiplication table for any number

Program-This creates table of a number upto 10.

Sub Button4_Click()
Dim num, i As Integer
num = InputBox("Enter a number whose multiplication table is to be found out")
For i = 1 To 10
Cells(i, 1).Value = num * i
Next i

End Sub


Comment below if you want code to create table upto any number.

Excel vba program to print a word in the order




Program

Sub Button1_Click()
Dim name As String
Dim length, i As Integer
name = InputBox("Enter a Name")
length = Len(name)
For i = 1 To length
Cells(i, 1).Value = Mid(name, 1, i)
Next

End Sub