The following program will do so
Imports System.Collections.Generic
Namespace ConsoleApplication1
Class Program
Private Shared Sub Main(args As String())
Dim input As Integer = 7
'Factorial of the number to find
Dim fact As Integer = 1
'a temporary variable to store the intermediate computed values
For Each number As var In Factorial(input)
fact *= number
Next
'display the result
Console.WriteLine("Factorial of {0} is {1}", input, fact)
Console.ReadKey()
End Sub
'generate the range of numbers - one at each cycle
Public Shared Function Factorial(number As Integer) As IEnumerable(Of Integer)
Dim startIndex As Integer = 1
'loop continues till the condition becomes false
While startIndex <= number
yield Return startIndex
startIndex += 1
End While
End Function
End Class
End Namespace