Sunday, October 23, 2005
Random Text Generator
This function will return random text (a-z) for the specified length. For ex. Randtxt(5) will return xythp.
This sub will return random text for the specified length and number of random texts needed.
'---------------------------------------------------------------------------------------
' Procedure : Randtxt
' DateTime : 10/23/2005 11:54
' Author : Ashutosh
' Purpose :This function will return random text for the specified no. of chars
Function Randtxt(nochars As Byte) As String
On Error GoTo Randtxt_Error
If nochars = 0 Then Exit Function
Dim sResult As String, i As Long
sResult = ""
For i = 1 To nochars
sResult = sResult & Chr(Int(Rnd * (122 - 97) + 97))
Next i
Randtxt = sResult
Exit Function
Randtxt_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in function Randtxt"
End Function
' Procedure : Randtxt
' DateTime : 10/23/2005 11:54
' Author : Ashutosh
' Purpose :This function will return random text for the specified no. of chars
Function Randtxt(nochars As Byte) As String
On Error GoTo Randtxt_Error
If nochars = 0 Then Exit Function
Dim sResult As String, i As Long
sResult = ""
For i = 1 To nochars
sResult = sResult & Chr(Int(Rnd * (122 - 97) + 97))
Next i
Randtxt = sResult
Exit Function
Randtxt_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in function Randtxt"
End Function
This sub will return random text for the specified length and number of random texts needed.
' Procedure : Randtxt1
' DateTime : 10/23/2005 12:12
' Author : Ashutosh
' Purpose : This sub will return and no. of random text random text for the
'specified no. of chars needed starting from the activecell
Sub Randtxt1()
Dim nochars As Byte
Dim nos As Long
nochars = InputBox("Enter the length of the random text", , 1)
nos = InputBox("Enter the number the random texts needed", , 1)
On Error GoTo Randtxt_Error1
If nochars = 0 Then Exit Sub
Dim sResult As String, i As Long, j As Long
For j = 1 To nos
sResult = ""
For i = 1 To nochars
sResult = sResult & Chr(Int(Rnd * (122 - 97) + 97))
Next i
ActiveCell.Offset(j - 1, 0) = sResult
Next j
Exit Sub
Randtxt_Error1:
MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure Randtxt"
End Sub
' DateTime : 10/23/2005 12:12
' Author : Ashutosh
' Purpose : This sub will return and no. of random text random text for the
'specified no. of chars needed starting from the activecell
Sub Randtxt1()
Dim nochars As Byte
Dim nos As Long
nochars = InputBox("Enter the length of the random text", , 1)
nos = InputBox("Enter the number the random texts needed", , 1)
On Error GoTo Randtxt_Error1
If nochars = 0 Then Exit Sub
Dim sResult As String, i As Long, j As Long
For j = 1 To nos
sResult = ""
For i = 1 To nochars
sResult = sResult & Chr(Int(Rnd * (122 - 97) + 97))
Next i
ActiveCell.Offset(j - 1, 0) = sResult
Next j
Exit Sub
Randtxt_Error1:
MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure Randtxt"
End Sub
Labels: String Operations
Tuesday, October 18, 2005
Microsoft Office Assistance: Summing up ways to add and count Excel data
Check this web page for these forumals to do counts and sum. I didn't know they had SUMX2PY2 kind of thing. Wow! Great!: "Summing up ways to add and count Excel data"
If you want to See
Add the product of corresponding values in multiple arrays SUMPRODUCT
Add the square of each value in a range SUMSQ
Add the sum of the square of corresponding values in two arrays SUMX2PY2
Add the difference of the square of corresponding values in two arrays SUMX2MY2
Add the square of the difference of corresponding values in two arrays SUMXMY2
If you want to See
Add the product of corresponding values in multiple arrays SUMPRODUCT
Add the square of each value in a range SUMSQ
Add the sum of the square of corresponding values in two arrays SUMX2PY2
Add the difference of the square of corresponding values in two arrays SUMX2MY2
Add the square of the difference of corresponding values in two arrays SUMXMY2
Wednesday, October 12, 2005
Smart Computing Article - Basic Troubleshooting
Smart Computing Article - Basic Troubleshooting: "Whether Excel refuses to launch or just refuses to open a file, there are many steps you can take to restore the application to full working order. "