Final Research and Trade Workshop Guide

Total Page:16

File Type:pdf, Size:1020Kb

Final Research and Trade Workshop Guide

Final Research and Trade Workshop Guide

Excel Modeling Start with your own bank statement See where you are spending the most and when Basic Steps 1. Define your scope a. Always a MUST 2. Allow room to build a. You do not want to run into a situation where you cannot scale your model 3. Identify Inputs a. A perpetual process to find and perfect 4. Quality Control a. Be sure to add means to ensure accuracy as you build 5. Maintain uniformity a. It permits spreadsheets to become automatic b. Constants and variables

Simple VBA Rules Object.Method

1. Define your task a. What you wish to program b. The overall task must be broken down into smaller tasks c. The program consists of a set of instructions or code, which the computer will follow d. The order in which you place these statements is very important

2. Procedures: Sub, Function and Property a. Sub a.i. Executes code line by line in order, performing a series of actions and/or calculations a.ii. Carried without an answer a.iii. File, save is an action and doesn’t return the answer b. Function b.i. Carries out a procedure and returns an answer 3. Variables a. Integer a.i. Integer variables are used to store whole numbers b. String b.i. Variables used to store text c. Double c.i. Can store decimals (5.5) d. Boolean d.i. Variable to hold the value true or false 4. Looping a. One of the most powerful programming techniques. Enables the user to loop through a range of cells with a few lines of code b. Single Loop b.i. To loop through a one-dimensional range of cells

Macro

Sub Get_data() ' ' Get_data Macro ' Dim ticker As String, sday, smonth, syear, eday, emonth, eyear As Long Columns("A:G").ClearContents ticker = Range("K1") sday = Day(Range("k2")) smonth = Month(Range("k2")) - 1 syear = Year(Range("K2")) eday = Day(Range("k3")) emonth = Month(Range("K3")) - 1 eyear = Year(Range("k3"))

' With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;http://real-chart.finance.yahoo.com/table.csv?s=" & ticker & "&d=" & emonth & "&e=" & eday & "&f=" & eyear & "&g=d&a=" & smonth & "&b=" & sday & "&c=" & syear & "&ignore=.csv", Destination:=Range("$A$1$")) .Name = "Datatable" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .TextFilePromptOnRefresh = False .TextFilePlatform = xlMacintosh .TextFileStartRow = 1 .TextFileParseType = xlDelimited .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = True .TextFileTabDelimiter = True .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = True .TextFileSpaceDelimiter = False .TextFileColumnDataTypes = Array(5, 1, 1, 1, 1, 1, 1) .Refresh BackgroundQuery:=False .UseListObject = False End With End Sub

Recommended publications