Loop Macro Which Downloads Historical Stock Information?

Feb 21, 2012

How to loop a macro which downloads historical stock information into Excel. I had the macro working for a single sheet, but I want it to update all of the sheets in the work book except a few. Now I keep getting a Error # 1004 unable to open error on line .Refresh BackgroundQuery:=False

Code:

Sub GetData()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
' Exclude certain sheets
If ws.Name "Porfolio" Or ws.Name "Benchmark" Then

[Code]....

QueryQuote:

With ActiveSheet.QueryTables.Add(Connection:="URL;" & qurl, Destination:=DataSheet.Range("A5"))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With

[Code]....

View 1 Replies


ADVERTISEMENT

VBA Code / Stock Historical Price Macro?

Jul 10, 2012

I am looking for this one function i need for a school project on historical stock prices in excel.....basically i need a way to perform this function:

In row 1, i have 30 RANDOM historical dates, starting in B1 and going right
In column A, i have 10 stock symbols, starting in A2 and going down

Is there a way to automatically grab the ADJUSTED CLOSING PRICE for each symbol for each corresponding date?? if not i have to do it manually!!

View 3 Replies View Related

Historical Stock Prices

Jul 24, 2008

how do i download historical stock prices for approx a hundred stocks i.e what code would suffice?

View 9 Replies View Related

Create Macro That Downloads Daily Settlement Price

Oct 28, 2010

I have an excel worksheet that has the following:

Column A: Date
Column B: Crude Oil Settlement Price
Column C: formula for daily change
Column D: another formula

I tried recording a macro, no dice... I need it to print today's date, the settlement price, and copy down the formulas in the next available cell.

View 9 Replies View Related

Find Company Stock Information Based On Date & Symbol Input

Mar 9, 2008

What I have is an output of about 30 worksheets of individual stock data in a workbook, all with the same column headings, laid out like the following (so that the Column Headings are stock data as recorded on the Date in Column A):
<Stock Name>
<Date> <Price> <Price to Book> <etc.>
with the stock titles also as the names of the worksheet.

What I want to do is create a macro that outputs to a single worksheet where I can input the stock name and a certain date for the stock, and then have it insert the appropriate row from the stock's worksheet underneath.

So, if I say I want the data for Stock A on March 24, 2007, I can input those two and have it output the appropriate rows from the worksheet.
Or, more generally, I can create a list of stock names and dates, and have the macro output that data underneath.

View 3 Replies View Related

Cell Update With Real Time Stock Quotes For Particular Stock

Aug 7, 2012

What is the easiest way to have a cell update with real time stock quotes for a particular stock?

View 4 Replies View Related

Stock Order Sheet To Be Created From Stock Inventory

Jan 8, 2014

I have created a stock sheet on Sheet1, i have say 100 items and each item has a min and max stock order. Once the item hits a min low, the last cell (O) will display an order needs to be placed.

I was wondering if there way a way that on sheet2, it can calculate all the data on sheet1 and if there is stock that needs to be ordered, it will appear on sheet2?

This way i can just print sheet2 and send it to the supplier without having the entire 100 items displayed -if it does not need to be ordered?

View 7 Replies View Related

Sumif: Downloads The Data

Oct 29, 2007

I have the following sumif formula in a spreadsheet. Unfortunately, the columns where I search the data and the columns needing to be summed will vary depending on how the user downloads the data.

Using VBA I've designed a sub-routine that dynamically identifies and returns to the spreadsheet in cell AC57 the letter of the column that contains the criteria I need to search on (in this case, 'S') and the letter of the column to add up (in this case, 'H') which is contained in cell AD57. How do I get the sumif formula to accept these columns as string arguments?

The cell that contains column 'S' (the search criteria column) is cell AC57.
The cell that contains column 'H' (the sum column) is cell AD57.

View 2 Replies View Related

Concatenate With Loop Through 2 Columns Of Information

May 28, 2014

I have a list of names with blank cells in Column A cell 2.

I want the programme to scroll through this column until it finds a name, when it does I want it to look in cell offset(1, 1), in this case B3 to see if there is a number. I want this number to be moved to offset (0, 1) AND any subsequent numbers below it until the next blank cell in that column (B).

In the attached image cell B2 will contain all numbers in cells B3:B9 with a / between them. Cell B10 will have number from B11 and B12 will have B13:B15. If there is no number it will just continue to the next name in column A. My rough code below delivered the first number only in the relevant cell and I'm not clever enough to get it right. It does not have to be super slick as it's for one time use.

I need numbers in column B cleared as they are concatenated into the single cell.

Spreadsheet.jpg

View 12 Replies View Related

Automate Downloads From Server Using WinSCP

Apr 30, 2008

I've created some code to automate file downloads from a server using WinSCP. The code creates a .bat file and a .dat file containing a script to transfer files using WinSCP.

When the VBA code runs the script using Shell, the terminal window opens and closes in a flash and the download does not execute. However, if I execute the .bat file outside of VBA the whole download process works great!

Sub GetFilesFromServer()

Call GetLogin

Dim fs As Object
Dim a As Object
Dim retVal As Long
Dim col As Long
Dim row As Long
Dim PBSPath As String
Dim reportName As String
Dim newName As String
Dim targetDate As Long
Dim reportDate As Long
Dim targetDir As String

View 5 Replies View Related

Pivot Table Or Macro For Stock Layout

Jul 22, 2007

I have an excel file, attached. I have a system that output all the stock in the format of sheet "price listing".

At the moment I manually create the layout for the text in "sheet 1" and use a macro to update prices etc. There are about 400 lines in the full listing and having to update the layout constantly for new products, deleted products is very time consuming. I send this list to customers every few months for them to see the range and the prices, so it has to look well.

I am looking for a macro or a pivot chart or something that I would be able to run on the "price listing" sheet and would put it in some usable format. Different customers can have different prices so that it needs to be quick and flexible. I send this list to customers every month for them to see the range and the prices, so it has to look well. Is there any way to create an index also from an excel workbook?

View 10 Replies View Related

Customize And Lock A Range For Each User Who Downloads File

Feb 15, 2010

I've got an Excel file that I'll be offering for download. I'd like to customize each copy for each user as they download it from the server and am trying to figure out if this is possible & what technology I'd need to use to do so. Simply, I'd like to edit a range in a document, lock it with the built in Excel password protection, and then resave it for the user. Is it possible to write a script to do this w/o opening the file? Any ideas on what technology I'd need to use to do so (.NET framework? OWC?)?

View 4 Replies View Related

Copy Information From Variable Workbooks To Master File Then Loop?

Apr 30, 2014

What I have is a master file that needs to pull info from other sources (a simple copy and paste)
those files are called Inventory_xxxx.xlsm . Inside the master file, there are cells with the number of the inventory.

What i need is a way to tell excel to check what number is in the cell, open the files with that number, get the info from the files and paste it back in the master file... and the part that i consider the trickiest, a way to loop it.

For example, lets say i have 2248 in cell A10, it should open Inventory_2248.xlsm copy the contents from cell N4, O4, P4, Q4, R4 and S4(Inventory File) into N10,R10,S10,T10 and U10 (Master file) respectively then in A11, there could be a 2250 so it should open the 2250 file get the info, paste it and so on.....

Now I don't even know if this is do-able or just impossible, been fiddling with various codes to no avail.

View 4 Replies View Related

Macro With Formulas - Subtracting Next Order With Current Stock

Mar 25, 2014

I would like to use this database list I export from another program to excel format. What I want to do is to change in the C column.

The value under Akt.saldo is how much of a given article we have in stock (saldo). And the Rest. in column B is the reservation, how much of that article thats is going to be shipped at that day. ex 14161 year(14) week(16) day(1).

So as you can see in column C the Rest. value never subtracts from the stock. What is want is something like that below.

Here is just selected all the values under stock and moved to the next column. Then used white color to hide it.

Here i subtract the hidden value with the reservation to be able to see how much is left after that order.

And the same here. Subtracting next order with the current stock.

How do i do this with a macro? The list is changing everyday.

View 2 Replies View Related

Forecasting Using Historical Seasonally Effected Non-linear Data

Jan 15, 2010

Forecasting using historical seasonally effected data

I organize my thoughts in numbers so it will be easier to understand.

[1] Say I have this data from January 2009 to December 2009:

1-4-7-10-13-14-15-16-18-20-22-25

As you can see, the growth is not linear.

[2] So then, I start with this data point for Janaury 2010.

26-a-b-c-d-f-g-h-i-j-k-l

[3] I now want to forecast that data point for the rest of 2009...using the growth in [1]. SO i guess that's an easy task right? Take the percentage change from Jan 08 and Feb 08...and apply that to the 26...and so on. (am i correct here at least).

[4] But lets say we have a GOAL. So, this become a forecast/plan. In December 2010, i want to grow double the amount of that in December 09. So 25 x 2 = 50. Now, the "known" data is like this:

26-a-b-c-d-f-g-h-i-j-k-50

So how do i do this now?

View 9 Replies View Related

Macro To Find And Add ISIN For A Company Based On Stock Codes

Jul 20, 2014

I have trying for 2 days now to write a macro/VBA that looks up IF the stock codes (i.e., in column A and G) match THEN insert the ID_ISIN from column H in the empty ISIN column C.

or should i use Vlookup?

View 3 Replies View Related

VBA Code To Move Data From Entry Sheet To Historical Sheet By Date

Apr 17, 2014

In the attachment you will see an example of what I am trying to accomplish. What I am trying to do is find VBA code that will move data by date from an (Entry) sheet to a (Historical) sheet. I want to enter a date in B3 on the (Entry) sheet. I then enter data into C3. What I would like to happen is when the data is entered into C3 the sheet goes and finds the same date that I entered in B3 and copies that data from C3 into Column E of the (Historical) sheet.

Test3.xlsm

View 5 Replies View Related

Code To Move Data From Entry Table To Historical Table By Date

Mar 14, 2014

In the attachment you will see an example of what I am trying to accomplish. What I am trying to do is find VBA code that is either specific to this worksheet or in a macro. When the sheet is opened I enter a date in B2. I then enter data into A7, B7, and C7. What I would like to happen is when the data is entered into A7, B7, and C7 the sheet goes and finds the same date that I entered in B2 and copies that data from A7, B7, and C7 into F7, G7, and H7.

View 2 Replies View Related

Macro To Pull Information From One Tab To Another

Dec 9, 2009

I am trying to put together a macro to pull data from one tab to another. The key here is that I want it to take the entire row.

Basically it will look something like this:

As someone goes down the rows of the checklist putting x's in the boxes that need one (there is a column set aside for that), that box will turn red.

That part is easy and done.

What I cant figure out how to do next is to automatically have a copy made of the row with the red cell and send them to another document.

View 13 Replies View Related

Macro To Take Information From Word

Sep 21, 2006

I have a form in Word that I go through and fill out different fields in the table with text. I need to be able to copy each specific field to an excel spreadsheet so we can have a database of the info. So far I am just recording a macro and trying to modify it. I can get excel to open.

Sub Testing()
Selection.HomeKey Unit:=wdStory
Selection.MoveDown Unit:=wdLine, Count:=2
Selection.MoveRight Unit:=wdCell
Selection.Copy
Set appEX = CreateObject("Excel.Application")
appEX.Visible = True
appEX.Workbooks.Open FileName:="D:/AE Service Session/macro.xls"
End Sub

It needs to take the value that it copied and paste it into the first blank cell in column A.

View 9 Replies View Related

Macro To Consolodate Information

Jun 7, 2007

I have a workbook with several SHEETS e.g Red, Green, Blue, Orange etc
I need a macro which will consolodate data to a Sheet named ALL

The macro needs to look at the first SHEET e.g. Red sheet Starting at C3 down to last record in C , COPY the information to the ALL SHEET, starting at C3. Move onto the next SHEET e.g Blue Sheet Starting at C3 down to last record in C then apend these records to the last enty in the ALL sheet.
etc. etc. for about 15 different colour sheets. I need to end up with all the records on the ALL sheet.

View 9 Replies View Related

Macro: Get Information From Two Sheets

Oct 2, 2007

I am trying to get information from two sheets. I have added the lines myarray1 and mystring1. I also added myarray1 in the For Statement. I cannot get it to run correctly. If you take these two lines out, and the myarray1 out of the FOR statement it works for one sheet.

Sub test()
On Error GoTo notfound
myarray1 = Array("A", "D", "G", "H", "I", "End")
myarray = Array("A", "Q", "R", "S", "T", "U", "V", "X", "Y", "Z", "AB", "AC", "END")
For i = 0 To WorksheetFunction.Match("END", myarray1, myarray, 0) - 2
x = WorksheetFunction.Match(ActiveCell.Value, Sheets("phones", "computers").Range("a:a"), 0)
mystring1 = mystring & Sheets("phones").Cells(1, myarray1(i)).Value & ": " & Sheets("phones").Cells(x, myarray1(i)).Value & Chr(10)
mystring = mystring & Sheets("computers").Cells(1, myarray(i)).Value & ": " & Sheets("computers").Cells(x, myarray(i)).Value & Chr(10)
Next i..........................

View 9 Replies View Related

Userform Data (allows Input Of Information And Then Deposits The Information On A Specific Sheet)

Feb 11, 2010

I have created a userform that allows input of information and then deposits the information on a specific sheet. I am looking for a way to have that information not only deposited on the specific sheet it is already set to but also to another sheet based on a selection made from a combo box.

here is my current

View 5 Replies View Related

Macro To Create And Compile Information

Feb 6, 2010

Currently where I work we print out registers to keep track of student attendances. This is done by merging an excel document that contains all the details of the names, days, dates , times, student groups and rooms of each lesson (each row contains the details for one lesson) with a word document containing the appropriate list of students in each specific group along with blank mail merge fields that relate to the excel document.

There are often 100 lessons a week meaning it takes an age to merge all the documents to create the registers.

Instead of this method I'd like the tutor to print off their own register by opening the excel document and clicking a button at the end of the appropriate row that contains the details for the lesson they are teaching. This would then take the details from that row and generate the appropriate register on another worksheet. Importantly it would have to list the correct group of students for each lesson - the names of these groups would be listed on other sheets.

Im guessing macros would be the right way to do this, but I have no real knowledge of them so alternatives would be helpful. Can anyone point me in the right direction? I've included a sample of how it would look with just one lesson in the excel doc.

View 8 Replies View Related

Macro To Link Information Between Two Worksheets?

Jul 11, 2012

I need to link information between two sheets.

In Sheet2 I have a list of products with their description in adjacent columns such as prices and other information. Sheet1 is a MasterSheet of some of the products listed in Sheet2. So I would like to write a macro that links the information of the product from Sheet2 to Sheet1 if I type the products name in Sheet1 (MasterSheet). The list of products (Sheet2) is updated in a regular basis, so by linking the info I would just need to update Sheet2 and Sheet1 would update as well.

View 4 Replies View Related

Macro With Information From Multiple Sheets?

Dec 30, 2012

I am writing a macro that organizes data, but also needs to be able to conditionally copy data from other sheets in a workbook.

I have a table with values...column A has the identifiers (strings of letters) and column N has comments related to the data in each row. So, for example, row 3 column A has the value "AAPL," and row 3 column N has the related value "sells electronic goods."

Now, I want to be able to copy column N based on the value of column A into other sheets using my macros. So, say I have another sheet in the workbook and row 6 column A has the value "AAPL," I want row 6 column N to have the related value from the previous sheet. Is it possible to do this?

View 2 Replies View Related

Macro :: Fill The Information Into The Next Empty Row

Jan 16, 2009

I have been helping a friend keep track of his clients, by making a form for them to fill out when they become a client of his (he owns a care rental) and I made a spread sheet for him to keep track of which cars are out when...

With that said, I would really like to have a Macro that i could run, when the form with all the personal information about hte client had been filled out - take that information and pull it over into another spead sheet that keeps track of all clients.

Meaning that workbook 1 is set up as a booking form and workbook two is just a normal list. I can make a macro that pulls over the infomation - but the problem is that it will always pull the information into row 1. Meaning that it overwrites itself each time I run it. I would like the Macro to know that it has to fill the information into the next empty row.

View 9 Replies View Related

Macro To Enter Information On A New Line

Mar 14, 2007

I am creating a macro that will take some information from 3 cells that the user will input, place it into 3 different cells, clear the original 3 cells and then I would like the macro to, when next activated input the new information from the 3 cells below the information that was already in the table.

For Example,
Date (D3), Description (E3, F3, G3 Merged cell) and Reference (H3)

I would then like those 3 cells to be put into A9:E9 then clear the original cells. That is not the part that I have the problem well, the following however, is.

After I enter new information into the input cells, and press the macro button, I would like the information to be placed into A10:E10 and from then on, the information goes down by 1 row after each macro.

View 11 Replies View Related

Macro To Copy And Paste Information To A New Worksheet

Jan 16, 2014

I am a complete amature at Marco's and formulas. I have been trying to create what i need but i am unable to get it to work. I have a worksheet named "Course dates incl. pursuit" which has a table which runs from B7 to J144 in the table it has date, number, name, location, job, area, notifified, on system and passed?. in that order. I want if the passed column which is in J if that has a Y in it to copy and paste into another worksheet on the next avaliable line, worksheet name "Master."I would like it in a slightly different order if that is possible they have the same titles on the table but would like it to go number, name, location, job, area and date. Running from B5 to G(end of spreadsheet). That is the main part i would also like to to copy and paste into another worksheet if the answer is "N" but the above part is the most important part. Due to the computer settings i am unable to attach it

View 6 Replies View Related

Macro Protection Using Information From External File?

Jun 21, 2014

I was wondering if it is possible to protect a macro to be used only if a *.txt (for example) file wit some certain text is available. like a key to run hidden in a text. The file is situated in a company network, and i want to protect it from taking the file out of the company. I can do it to check for presence of a file - if the file is not available - the macro exits. but if someone break the password that is protecting the code will see the blocking point immediately. this is why i want to use a key....

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved