Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Excel


Regression Automation In Vba

The above is a screenshot of the data analysis (regression) I want to automate with vba code. Like all macros, I tried to record first and only got the following

View Complete Thread with Replies

Sponsored Links:

Related Forum Messages:
Linear Regression?
I was handed the attached file. understand everything except how the values in row 6 were derived No formula present when I received the file, just the numbers. Row 7 is hard entered scores the units achieved

View Replies!   View Related
Constrained Regression Using Solver
I have the following dataset and was wondering how I can run a constrained regression in Excel with the constraint being that the total allocation of assets is 100%:

Total return (y): 12 data points
Asset 1 (x1): 12 data points
Asset 2 (x2): 12 data points
Asset 3 (x3): 12 data points
Asset 4 (x4): 12 data points
Asset 5 (x5): 12 data points
Asset 6 (x6): 12 data points

[Attached is a spreadsheet with the actual dataset]

I know the regression equation I need is R = b1X1 + b2X2 + .+ (1 - b1 - b2 -.- b5 )X6 + e

View Replies!   View Related
Using The Regression Function From Within A Macro
I am wanting to write a macro which uses the excel multiple regression function (a part of the data analysis add-in). I tried recording a macro while I selected the regression function (Tools> Data Analysis... etc.) which produced the following:

View Replies!   View Related
Quadratic Regression Calculation
I am trying to set up the formula y = ax^2 + bx + c. Is there a function for that in excel?

To get a little more into my overall goal. I will have a x constant that will remain the same, but I have 8 different sets of a,b, & c coefficients. So, I would like to set up something like, if a row is labeled A1, find the A1 set of coefficients and use them in the quadratic equation. I was thinking I would need to use a CSE, is that correct?

View Replies!   View Related
Linear Regression Over The First 5 Points In The Set Of Data On The Same Graph
I have a set of data. I know how to do linear regression over the whole set of data. How do I have another linear regression over the first 5 points in the set of data on the same graph ?? I am using Excel 2007

View Replies!   View Related
Incorporating Data Analysis: Regression Into A Macro
I'm trying to write a macro that will analyze data from one spreadsheet and do a regression. The information I want to be output on the same sheet. I tried to use the record function, but I got an error. It said "Run-time error '1004': ATPVBAEN.XLA could not be found. The code read:

View Replies!   View Related
Regression Coefficients Estimated Incorrectly When Centered Predictors Used
to getting accurate regression coefficients from a dataset with *small* (standard) numbers, which contains centered predictors. More specifically, I have a dataset with 18 observed data points containing a criterion (y), a centered predictor variable (x), another centered predictor variable (z), and the interaction of the two centered predictor variables (xz). This multiple regression equation is structured to test for interactions between the two continuous predictor variables (x and z) as prescribed by Aiken and West (1991) in their classic book.

When I run the regression in Excel with the centered predictors, some of the regression coefficents in the output are estimated to be 0, although they are clealry *not* 0 as estimated by SPSS 14.0.2. I have spent many hours troubleshooting this problem (and searched many forums on the internet) and still do not know why this is happening.

Initially, I thought the problem might have to do with the cross-product of the centered predictors, but even just doing a regression with one of the centered predictors (for certain centered predictors) yields a regression coefficient of 0 (although it should be non-zero as per SPSS 14.0.2). When doing these multiple regressions with non-centered predictors, all regression coefficients are estimated accurately.

I was wondering if anyone had any insights on why I am experiencing these problems.... If anyone wants a sample of some test data I have used to troubleshoot these problems, you can download a file from: [url] and/or email me at (email deleted by Mod) for more datasets or questions.

View Replies!   View Related
IE Automation
I'm trying to do some automation of a website that has one of those annoying javascript popup dialog boxes you have to click OK on before you can progress. How can I kill that so that I don't have to manually click on "Ok" so that my macro can keep running?

View Replies!   View Related
VBA Into IE Automation
You take an input, click a button. This will them create a small HTML table with a text input box and another button.

Sub VisitWebsite()
Dim ie As Object
Dim tcode As String
Dim sURL As String
sURL = http://sample.jsp
ie.navigate sURL
ie.Visible = True
tcode = "apples"

While ie.busy
Application.Wait Now() + TimeValue("00:00:03")

For Each ieForm In ie.document.forms
ieForm(1).Value = tcode
Set ieForm = Nothing
Exit For
The code ieForm(1).Value = tcode works. The code ieForm.submit also hits submit on the button.

The problem is I cannnot figure out how to access the 2nd button which is generated when you click the 1st button. I have tried every variation of ieForm(1).Value. There appears to be only 3 forms (0, 1, 2). When I try 3 or greater, I get an error.

When I use ieForm(2).Value = "something", the Retrieve button text actually changes name to "something".

I've attached a screen shot of the webpage. I can insert text into the top Track Code box, and click Retrieve.

I can't change the text in the Routing Position field, and I cannot click the "Set" button. Any help would be greatly appreciated. I am still a beginner with VBA and it took me a while just to get it to work with the 1st input box.

View Replies!   View Related
Email Automation
I am trying to create a document that automatically sends an email whenever a field reaches a certain value. I am pulling the data from different worksheets onto a summary worksheet and using the data on the summary sheet as the point at which my code checks to see whether the value is below the minimum required. The summary sheet updates automatically whenever I change the data in one of the other sheets but the email will not send automatically when the summary sheet is updated. When I run the macro individually the email sends, however I need some way of triggering it so that it sends automatically upon the data in the field changing. Can anyone help me with this?

Here is an example of some of the code I am using:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("D3"), Target) Is Nothing Then
If IsNumeric(Target.Value) And Target.Value < 1 Then
End If
End If
If Not Application.Intersect(Range("E3"), Target) Is Nothing Then
If IsNumeric(Target.Value) And Target.Value < 1 Then
End If
End If
End Sub

View Replies!   View Related
Excel Automation - Timer?
I have a file that I update daily. It involves opening the file, going to a drop down menu and selecting 1 of the listed items and pressing a button to run the macro. Once the macro is complete, I then go back to the dropdown menu and select the next line item and press the same button to run the macro on this. I repeat this task 7times.

All the macro does is load a txt file to a third party system.

I am looking to see if it is possible to reduce the time it takes to do this task.

View Replies!   View Related
Automation Of Creating PDF Files
We are trying to automate the creation of PDF files for each sheet in an Excel file,a nd keep getting error messages. Can someone help? It produces the post script file, but it has no data nd then doesn't create a PDf file at all. We have Excel 2003, and have the below code setup.

View Replies!   View Related
UserForm - Automation Error
I created a UserForm (userform1) and added a label to it which essentially just says: "Pick a Colour"...

The other UF controls are added on the fly using the below code...however when I try to add the event to each button I get the Automation Error but I don't really understand how / why... the events are actually added to the VB project ok...

Private Sub UserForm_Initialize()
Dim NewButton As MSForms.CommandButton
Dim ws_i, line As Integer
Dim clr_str As String
For Each ws In ActiveWorkbook.Worksheets

I added a dummy routine for test purposes which is to be invoked on click of UF button control (I have tried placing this code in a standard module, within UF module etc to no avail):

Sub HIDE_WS(clr_id As Long)
MsgBox clr_id
End Sub

So to reiterate -- when I invoke the initialisation of the UF I get the following error:

Automation Error
The object invoked has disonnected from its clients

All events are added for each control.

If I remove the adding of the events I know the UF populates with the correct controls etc...

View Replies!   View Related
Pivot Charts Automation
pivot chart automation. I have a tab that contains thousands of rows and it grows larger on a weekly basis. On this tab is 169 peices of hardware I manage. Each week 1 row of data is added to all 169 peices of hardware. The data from the main tab contains metrics I need to chart. However, I am in need of a way of selecting a specific peice of hardware and having the pivot charts update automatically. There will be 26 Charts and going through each chart and selecting the proper hardware is going to take far too long.

Is there any way i can select just 1 peices of hardware from the data tab and have it populate all of these charts?

View Replies!   View Related
AddIn Automation Sequence
how to automate AddIns sequence when opening Excel? I have 5 different AddIn (xla) and I have to launch them in a specific order (after the menu Essbase is installed - with xll) cause I'm adding rows in that menu. Excel is launching my xla's in alphabetical order but before Essbase is installed.

View Replies!   View Related
Solver Automation VBA Code
I've done quite a bit of research in the past week or so on the topic of solver automation using loops; while there are a few good posts scattered around, i haven't quite found the solution to my problem.

i'm trying to run the solver on a few like-sized datasets contained in one worksheet. i've set up a loop to properly reference the 4 datasets. the solver constraints are in one column on the same worksheet.

the macro runs with no errors, but it doesn't "solve." the parameter cells retain their original values.

i should mention that my macro ran perfectly before i consolidated the 4 separate solver calls into one loop. I got tired of having to type 4 different constraint changes in the code as i was optimizing the solver.

on a similar topic, does anyone know how to call a variable in the FormulaText declaration? If i wanted to step through a defined array of constraints, say [1,2,3], how do i get FormulaText:= variable to work?

Sub Macrosolver()

Dim iteration As Long
Dim i As Integer
i = 8 'start in row 8 at first dataset

View Replies!   View Related
VBA - Can I Bypass/ignore Automation Errors
I have an ongoing project under constant upgrade. Essentially its a timesheet (used by about 40 secretaries) that gets sent to two administrators who import it into a report.

I have written a script to import these timesheets into a report which works fine and currently resides in a module which the administrators access via a command button on there report.

To make there life even easier I have constructed a script that triggers in event Sub Workbook_open (), embedded in the timesheets themselves, based on

If Application.UserName = "Admin1" Or Application.UserName = "Admin2" Then .....

View Replies!   View Related
VB.NET Automation Of Charts With Named Variables
I'm having a lot of trouble automating charts from my VB.NET program. I'm simply graphing one series of data as a time series that must maintain its order as the user filters the data, deletes some data, etc. Because of the changes the user can make, I am using a named variable with the offset command to maintain a dynamic range. I am aware of how to manually build the graph by supplying the series range =workbookname.xls!namedvariable, but I can't figure out how to supply this to my chart from my VB program. The following is some of my VB.NET code.

xlapp.names.add("graph" & i, "=OFFSET(Hidden!$A$20,0," & 1 + i * 3 & ",Hidden!$A$20,1)")
chartrange= ?
chartPage.ChartWizard(Source:=chartRange, HasLegend:=False, Title:=ParameterNames(i) & " Time Series")

I can supply more code if needed, but figured this would give a general idea of what I am trying to do. This has to work across multiple Office platforms so I am using late binding.

View Replies!   View Related
Advanced Filter Code Re Automation
I'm trying to automate advanced filter but can't get past having just 1 critreria.
I have attached an example spreadsheet where the download dump is on "Data" sheet and the result of the advanced filter is on the "Result" page. I would like, if possible, for the result to come up every time the criteria is put in (they are all data validation lists).

so for example, if i select account code, all those codes come up then select period and the list dwindles down and again for cost centre. Is it possible to do this without using macros. I have found the following code butnot sure what to do with it (sorry).

View Replies!   View Related
Gantt Chart Help With Conditional Formatting Automation
Hey Guys- I'm not sure if this is even possible but I need some help. I have attached a file below similar to a gantt chart. I need help with the conditional formatting, as I have manually changed the colors to match what I need automated.

Basically I have 6 tasks and I need to change dates for individual projects but I also need the corresponding color to also change.

View Replies!   View Related
Automation Error The Debugger Is Marking The Line With N =...
I receive an automation error, when using this code, the debugger is marking the line with n =...

View Replies!   View Related
Enhance Automation Of Importing Charts To PowerPoint
Right now the code takes charts & tables from all sheets in a workbook. I would like to limit this to only charts on one tab - CHARTS.

I am also looking to tweak this to open an existing presentation, as well as apply a template instead of simply pasting to blank slides.

Sub Chart2PPT()
Dim objPPT As Object
Dim objPrs As Object
Dim objSld As Object
Dim shtTemp As Object
Dim chtTemp As ChartObject
Dim objShape As Shape
Dim objGShape As Shape
Dim intSlide As Integer
Dim blnCopy As Boolean

Set objPPT = CreateObject("Powerpoint.application")
objPPT.Visible = True
objPPT.ActiveWindow.ViewType = 1 'ppViewSlide

For Each shtTemp In ThisWorkbook. Sheets
blnCopy = False
If shtTemp.Type = xlWorksheet Then
For Each objShape In shtTemp.Shapes 'chtTemp In shtTemp.ChartObjects
blnCopy = False
If objShape.Type = msoGroup Then
' if ANY item in group is a chart................

View Replies!   View Related
Data Import Automation - Multiple Csv Files
-I receive files everyday by email and saved in a folder C:TEST
-each file saved by name Name+daily date
( like: sale_20091214, sale_20091215, sale_20091216 )
-file is in csv/Comma delimiated format
-each file have 7 columns A to G and contain 256 rows
-i only need 7 or 8 rows & only need value in Column 'F'
-the rows i need are going to be same each time
I want to save automated data in a file name: MonthlySale located in c:
Fore each ROW data should be saved in new column next to last saved column.
data from file sale_20091214 should be saved in column B,
sale_20091214 should be saved in column C,
sale_20091214 should be saved in column D and onward.

View Replies!   View Related
Automation Error With Userforms InVBA Code
So I haven't seen this error before. It says "Automation error: the object invoked has disconnected from its clients."
I think I know what's causing it but am not sure how to go about solving the problem.
Barring any inefficiences that the code below contains, can someone please tell me what code I should used to fix this error?

View Replies!   View Related
Automation Of Solver: Must Inputs Be Derived From Cells?
I'm trying to automate the solver using a vb program. I have found this example which is just about spot on for my needs:

View Replies!   View Related
Automation Error: Object Has Disconnected From Its Client
I developed an Excel application for some users. Everything used to wrok very well until recently. When the click some buttons, the error "Automation Error: Object has disconnected from its clients" appears. Problem is, everything works very well on my PC. We run the same Excel version, same OS but I can't seem to find a solution to this problem. I'd have posted the code I'm running here but I don't know how to use the code tags and I don't want to be banned from this forum.

View Replies!   View Related
IE6 Automation In VBA - Open A (child) Page On Clicking A Button In Main (parent)
My query is regarding internet explorer 6 automation via code in VBA (Excel 2003). I'm trying to open a page on clicking a button in main page.

I'm able to open both parent and child pages via VBA, but now want to automate events (like radio btn click etc) in child page.

below is my initial code -

Sub ListLinks()
Dim IeApp As InternetExplorer
Dim sURL As String
Dim IeDoc As Object
Dim i As Long

'Create new instance of IE
Set IeApp = New InternetExplorer

View Replies!   View Related
"Const StrURI As String" Issue * Now * Automation Error
I have some code that I am using to import the source code of multiple websites, or at least that is the end goal. I currently can make it import one website but i can't find a way to change the website as i loop the line i need to change is this

*The website link won't work, it is a log in only site, but i think there should be an easy fix but since i am only self taught i don't think i understand the basics behind why thimngs work

View Replies!   View Related
Any "automation Formula" To Update Monthly Report
I have lots of monthly reports to prepare. So what i do is to copy previous month report file and paste and rename it as current month report. Once i open it, i need to change the linking to the next colume of the source files. Eg Source files July is in Column H, then now i have to change it to Column I in my current month reports.

Furthermore, one file may have a few source files so the column may differ also.

View Replies!   View Related
Copyright 2005-08, All rights reserved