Trendline coefficients and regression analysis
Tushar has a great tutorial on his website. It tells you a lot about regression, trendline and using them in VBA. Check it out!
Trendline coefficients: “Trendline Coefficients and Regression Analysis”
Tushar has a great tutorial on his website. It tells you a lot about regression, trendline and using them in VBA. Check it out!
Trendline coefficients: “Trendline Coefficients and Regression Analysis”
This is what I had to do lots of times. Send the file path of an Excel workbook to my supervisor. So I created this macro to send the activeworkbook full file path to the specified user. This can actually be well modified to create an AddIn, but for now, this is what is going to be. Insert a module in the personal.xls and insert this code. A reference to “Groupware Type library” is a must to make this macro work.
Dim strRecipient As String
On Error GoTo SendEmail_Error
strRecipient = InputBox(“Enter the email address of recepient”, “Recipient Name”)
If strRecipient = “” Then
MsgBox “No Recipient specified”, vbCritical
Exit Sub
End If
Const NGW$ = “NGW”
Dim ogwNewMessage As GroupwareTypeLibrary.Mail
Dim StrSubject As String, StrBody As String
Dim strWkbkName As String, strWkbkPath As String
strWkbkName = ActiveWorkbook.Name
StrSubject = strWkbkName & “-File”
strWkbkPath = ActiveWorkbook.Path
StrBody = “Please find the file-” & strWkbkName & ” here- ” & strWkbkPath & “\” & strWkbkName
StrBody = StrBody & vbCrLf & vbCrLf & “Thanks”
If ogwApp Is Nothing Then ‘Need to set object reference
DoEvents
Set ogwApp = CreateObject(“NovellGroupWareSession”)
DoEvents
End If
Dim StrLoginName As String, StrMailPassword As String
Set ogwRootAcct = ogwApp.Login
Set ogwNewMessage = ogwRootAcct.WorkFolder.Messages.Add(“GW.MESSAGE.MAIL”, egwDraft)
DoEvents
With ogwNewMessage
.Recipients.Add (strRecipient)
‘Assign the SUBJECT text
.Subject = StrSubject
‘Assign the BODY text
.BodyText = StrBody
‘Send the message
.Send
DoEvents
End With
On Error GoTo 0
Set ogwRootAcct = Nothing
Set ogwNewMessage = Nothing
Set ogwApp = Nothing
Exit Sub
SendEmail_Error:
MsgBox “Error ” & Err.Number & ” (” & Err.Description & “) in procedure SendEmail”
Set ogwRootAcct = Nothing
Set ogwNewMessage = Nothing
Set ogwApp = Nothing
End Sub
‘http://www.phhp.ufl.edu/~smanamal/misc/Groupwise.htm
‘http://www.vbaexpress.com/kb/getarticle.php?kb_id=277
Suppose if you want to increment a cell by 1 to see how your formulae handle that change, may be a simulation. That means that cell would be incremented by 1 everytime you hit F9 (keyboard short cut to make Excel recalculate). To achieve this do the following:
1. On the Tools menu, click Options, and then click the Calculation tab.
2. Select the Iteration check box.
3. Set the maximum number of times Microsoft Excel will recalculate, type one as the number of iterations in the Maximum iterations box
-MS Excel Help
Then enter this formula in the cell which you want to increment, suppose it’s A1.
Formula for A1: =A1+1.
That’s it! Now, every time you hit F9, that cell will be incremented by 1. If you want it increment by some other number, use that number in the formula.
Check this article @ MS’s website to know where to get help for VBA programming.
List of resources that are available to help you learn Visual Basic for Applications programming
Recently, I had the need of generating different types of random numbers. Although, Excel’s Data Analysis Toolpak can generate good random numbers, I had to create these functions to meet my needs.
First: Unique Random Numbers
This function was modified from ozgrid’s RandLotto function, which returns string. This function will return an array of unqiue random integers in the given range. If you want to return more than one number then this function should be entered as an array formula with Ctrl + Shift + Enter.
Second: Gaussian or Normal Random Numbers with specified mean and Standard deviation(SD). Now, this function is different than the Analysis toolpak utility because it generates random numbers on a fixed mean and Standard deviation. This function will allow the user to generate random numbers each with different mean and SD.
Third: Generate white noise or Guassian or Normal random numbers with mean = 0 and SD =1. Although, this could be achieved by the previous function, this function uses Box-Muller method. In this function too, you can use different mean and SD, although if not provided it would take mean =0 and SD=1
This is a screenshot of the Excel file. Also, the original Excel file can be downloaded here.
Recent Comments