Code throws an error when a breakpoint is added but not otherwise
I have data in a file like:
TIME|DIRECTION|ORDERID|SYMBOL|ROUTE||QUANTITY|PRICE
2012-05-29 11:17:18|B|1337|ZNGA|ARCA||6500|5.48
2012-05-29 11:17:53|B|1389|AAPL|ARCA||200|569.85
2012-05-29 11:18:22|S|1970|BRK/B|ARCA||600|77.48
2012-05-29 11:18:24|B|2335|BRK/B|ARCA||600|79.3
2012-05-29 11:19:27|B|2416|ZNGA|ARCA||4000|6.08
2012-05-29 11:19:29|S|2997|LNKD|ARCA||500|91.27
2012-05-29 11:19:40|S|3078|ZNGA|ARCA||3900|6.04
I am trying to write VBA code which will consume the data and return statistics based on ticker (cumulative quantity, price, etc.). I have written code using a dictionary object with a class object. This is for an assignment, so I have to do it that way.
If I just run the code, it compiles just fine. The numbers are incorrect (trying to fix that), but the code compiles.
When I add a breakpoint and try to step into the code, it started to do funny things. It ran fine for the first few runs, but it started breaking when I stopped runs/added things etc. If I step into the code, it seems to think that a dictionary object exists when it. So the statement If Not trades.exists(ticker) Then
evaluates as False
. Then it breaks on the line trades(ticker).cashVal = trades(ticker).cashVal - lineItems(posQuantity) * lineItems(posPrice)
when it presumably tries to search for a value but finds none.
The error is: Run-time error '424': Object Required.
Oddly, again, if I run it without the breakpoint it complies just fine.
Sub defineVar()
myFile = Range("$A$2")
End Sub
Public Sub test_everything()
Call defineVar
'Dim line As trade
Dim lines As Collection
Set lines = New Collection
Open myFile For Input As #1
Do Until EOF(1)
Line Input #1, file_line
lines.Add file_line
Loop
Close #1
Dim posTime As Byte
Dim posDirection As Byte
Dim posSymbol As Byte
Dim posQuantity As Byte
Dim posPrice As Byte
posTime = getColPosByHeader("TIME", lines(1))
posDirection = getColPosByHeader("DIRECTION", lines(1))
posSymbol = getColPosByHeader("SYMBOL", lines(1))
posQuantity = getColPosByHeader("QUANTITY", lines(1))
posPrice = getColPosByHeader("PRICE", lines(1))
Dim pos As Long
Dim ticker As String
Dim trades As Scripting.Dictionary
Set trades = New Scripting.Dictionary
Dim trade As Stock
Set trade = New Stock
pos = 2
While pos <= lines.Count
lineItems = Split(lines(pos), "|")
ticker = lineItems(posSymbol)
If Not trades.exists(ticker) Then
trade.symbol = ticker
trade.cashVal = 0
trade.positionVal = lineItems(posQuantity)
trade.endPriceVal = lineItems(posPrice)
trade.maxDateVal = lineItems(posTime)
trades.Add trade.symbol, trade
If InStr(1, lineItems(posDirection), "B") Then
trades(ticker).cashVal = trades(ticker).cashVal - lineItems(posQuantity) * lineItems(posPrice)
Else: trades(ticker).cashVal = trades(ticker).cashVal + lineItems(posQuantity) * lineItems(posPrice)
End If
Else:
If InStr(1, lineItems(posDirection), "B") Then
trades(ticker).cashVal = trades(ticker).cashVal - lineItems(posQuantity) * lineItems(posPrice)
trades(ticker).positionVal = trades(ticker).positionVal + lineItems(posQuantity)
If lineItems(posTime) >= trades(ticker).maxDateVal Then
trades(ticker).maxDateVal = lineItems(posTime)
trades(ticker).endPriceVal = lineItems(posPrice)
End If
Else: trades(ticker).cashVal = trades(ticker).cashVal + lineItems(posQuantity) * lineItems(posPrice)
trades(ticker).positionVal = trades(ticker).positionVal - lineItems(posQuantity)
If lineItems(posTime) >= trades(ticker).maxDateVal Then
trades(ticker).maxDateVal = lineItems(posTime)
trades(ticker).endPriceVal = lineItems(posPrice)
End If
End If
End If
Debug.Print trades(ticker).positionVal
pos = pos + 1
Wend
Dim k As Variant
For Each k In trades.Keys
Debug.Print k, trades(k).cashVal, trades(k).positionVal, trades(k).endPriceVal, trades(k).maxDateVal
Next
End Sub
Edited to Add:
This is what my class objects look like:
'Class Module: Stock
Public symbol As String
Public cashVal As Double
Public positionVal As Double
Public endPriceVal As Double
Public maxDateVal As Date
Does anyone know how to cure this curious problem?
excel vba
|
show 1 more comment
I have data in a file like:
TIME|DIRECTION|ORDERID|SYMBOL|ROUTE||QUANTITY|PRICE
2012-05-29 11:17:18|B|1337|ZNGA|ARCA||6500|5.48
2012-05-29 11:17:53|B|1389|AAPL|ARCA||200|569.85
2012-05-29 11:18:22|S|1970|BRK/B|ARCA||600|77.48
2012-05-29 11:18:24|B|2335|BRK/B|ARCA||600|79.3
2012-05-29 11:19:27|B|2416|ZNGA|ARCA||4000|6.08
2012-05-29 11:19:29|S|2997|LNKD|ARCA||500|91.27
2012-05-29 11:19:40|S|3078|ZNGA|ARCA||3900|6.04
I am trying to write VBA code which will consume the data and return statistics based on ticker (cumulative quantity, price, etc.). I have written code using a dictionary object with a class object. This is for an assignment, so I have to do it that way.
If I just run the code, it compiles just fine. The numbers are incorrect (trying to fix that), but the code compiles.
When I add a breakpoint and try to step into the code, it started to do funny things. It ran fine for the first few runs, but it started breaking when I stopped runs/added things etc. If I step into the code, it seems to think that a dictionary object exists when it. So the statement If Not trades.exists(ticker) Then
evaluates as False
. Then it breaks on the line trades(ticker).cashVal = trades(ticker).cashVal - lineItems(posQuantity) * lineItems(posPrice)
when it presumably tries to search for a value but finds none.
The error is: Run-time error '424': Object Required.
Oddly, again, if I run it without the breakpoint it complies just fine.
Sub defineVar()
myFile = Range("$A$2")
End Sub
Public Sub test_everything()
Call defineVar
'Dim line As trade
Dim lines As Collection
Set lines = New Collection
Open myFile For Input As #1
Do Until EOF(1)
Line Input #1, file_line
lines.Add file_line
Loop
Close #1
Dim posTime As Byte
Dim posDirection As Byte
Dim posSymbol As Byte
Dim posQuantity As Byte
Dim posPrice As Byte
posTime = getColPosByHeader("TIME", lines(1))
posDirection = getColPosByHeader("DIRECTION", lines(1))
posSymbol = getColPosByHeader("SYMBOL", lines(1))
posQuantity = getColPosByHeader("QUANTITY", lines(1))
posPrice = getColPosByHeader("PRICE", lines(1))
Dim pos As Long
Dim ticker As String
Dim trades As Scripting.Dictionary
Set trades = New Scripting.Dictionary
Dim trade As Stock
Set trade = New Stock
pos = 2
While pos <= lines.Count
lineItems = Split(lines(pos), "|")
ticker = lineItems(posSymbol)
If Not trades.exists(ticker) Then
trade.symbol = ticker
trade.cashVal = 0
trade.positionVal = lineItems(posQuantity)
trade.endPriceVal = lineItems(posPrice)
trade.maxDateVal = lineItems(posTime)
trades.Add trade.symbol, trade
If InStr(1, lineItems(posDirection), "B") Then
trades(ticker).cashVal = trades(ticker).cashVal - lineItems(posQuantity) * lineItems(posPrice)
Else: trades(ticker).cashVal = trades(ticker).cashVal + lineItems(posQuantity) * lineItems(posPrice)
End If
Else:
If InStr(1, lineItems(posDirection), "B") Then
trades(ticker).cashVal = trades(ticker).cashVal - lineItems(posQuantity) * lineItems(posPrice)
trades(ticker).positionVal = trades(ticker).positionVal + lineItems(posQuantity)
If lineItems(posTime) >= trades(ticker).maxDateVal Then
trades(ticker).maxDateVal = lineItems(posTime)
trades(ticker).endPriceVal = lineItems(posPrice)
End If
Else: trades(ticker).cashVal = trades(ticker).cashVal + lineItems(posQuantity) * lineItems(posPrice)
trades(ticker).positionVal = trades(ticker).positionVal - lineItems(posQuantity)
If lineItems(posTime) >= trades(ticker).maxDateVal Then
trades(ticker).maxDateVal = lineItems(posTime)
trades(ticker).endPriceVal = lineItems(posPrice)
End If
End If
End If
Debug.Print trades(ticker).positionVal
pos = pos + 1
Wend
Dim k As Variant
For Each k In trades.Keys
Debug.Print k, trades(k).cashVal, trades(k).positionVal, trades(k).endPriceVal, trades(k).maxDateVal
Next
End Sub
Edited to Add:
This is what my class objects look like:
'Class Module: Stock
Public symbol As String
Public cashVal As Double
Public positionVal As Double
Public endPriceVal As Double
Public maxDateVal As Date
Does anyone know how to cure this curious problem?
excel vba
this is a post where talk about error 424: stackoverflow.com/questions/21358540/…
– Ferdinando
Nov 16 '18 at 20:40
1
If your indentation is where you think theIf
andElse
statements match up, you should run this through an indenter. That said, I don't understand what the dictionary is even for - you're re-using the sameStock
object, so you end up with a single object in the dictionary under each different key.
– Comintern
Nov 16 '18 at 21:08
The idea is that each stock (FB, AAPL, etc) is a different key and returns each statistic for it. The number of unique stocks is unknown in the file. That's what I was trying to build, anyway, but there are bugs. Unfortunately I am having trouble debugging because the code won't compile if I add a breakpoint... If you have suggestions about my other issue though, I will gladly listen!
– thenifthenif
Nov 16 '18 at 22:05
Won't compile, or is throwing a run-time error 424? Those are two completely different things. Can you edit the question to include the code for theStock
class?
– Comintern
Nov 17 '18 at 0:31
Seems like Power Query might be more appropriate to use, depending on what exactly you're trying to achieve. It hasextract, transform, load
capabilities, so it can take structured/delimited data as input, which you can then transform into a table and load to an Excel sheet.
– chillin
Nov 17 '18 at 19:10
|
show 1 more comment
I have data in a file like:
TIME|DIRECTION|ORDERID|SYMBOL|ROUTE||QUANTITY|PRICE
2012-05-29 11:17:18|B|1337|ZNGA|ARCA||6500|5.48
2012-05-29 11:17:53|B|1389|AAPL|ARCA||200|569.85
2012-05-29 11:18:22|S|1970|BRK/B|ARCA||600|77.48
2012-05-29 11:18:24|B|2335|BRK/B|ARCA||600|79.3
2012-05-29 11:19:27|B|2416|ZNGA|ARCA||4000|6.08
2012-05-29 11:19:29|S|2997|LNKD|ARCA||500|91.27
2012-05-29 11:19:40|S|3078|ZNGA|ARCA||3900|6.04
I am trying to write VBA code which will consume the data and return statistics based on ticker (cumulative quantity, price, etc.). I have written code using a dictionary object with a class object. This is for an assignment, so I have to do it that way.
If I just run the code, it compiles just fine. The numbers are incorrect (trying to fix that), but the code compiles.
When I add a breakpoint and try to step into the code, it started to do funny things. It ran fine for the first few runs, but it started breaking when I stopped runs/added things etc. If I step into the code, it seems to think that a dictionary object exists when it. So the statement If Not trades.exists(ticker) Then
evaluates as False
. Then it breaks on the line trades(ticker).cashVal = trades(ticker).cashVal - lineItems(posQuantity) * lineItems(posPrice)
when it presumably tries to search for a value but finds none.
The error is: Run-time error '424': Object Required.
Oddly, again, if I run it without the breakpoint it complies just fine.
Sub defineVar()
myFile = Range("$A$2")
End Sub
Public Sub test_everything()
Call defineVar
'Dim line As trade
Dim lines As Collection
Set lines = New Collection
Open myFile For Input As #1
Do Until EOF(1)
Line Input #1, file_line
lines.Add file_line
Loop
Close #1
Dim posTime As Byte
Dim posDirection As Byte
Dim posSymbol As Byte
Dim posQuantity As Byte
Dim posPrice As Byte
posTime = getColPosByHeader("TIME", lines(1))
posDirection = getColPosByHeader("DIRECTION", lines(1))
posSymbol = getColPosByHeader("SYMBOL", lines(1))
posQuantity = getColPosByHeader("QUANTITY", lines(1))
posPrice = getColPosByHeader("PRICE", lines(1))
Dim pos As Long
Dim ticker As String
Dim trades As Scripting.Dictionary
Set trades = New Scripting.Dictionary
Dim trade As Stock
Set trade = New Stock
pos = 2
While pos <= lines.Count
lineItems = Split(lines(pos), "|")
ticker = lineItems(posSymbol)
If Not trades.exists(ticker) Then
trade.symbol = ticker
trade.cashVal = 0
trade.positionVal = lineItems(posQuantity)
trade.endPriceVal = lineItems(posPrice)
trade.maxDateVal = lineItems(posTime)
trades.Add trade.symbol, trade
If InStr(1, lineItems(posDirection), "B") Then
trades(ticker).cashVal = trades(ticker).cashVal - lineItems(posQuantity) * lineItems(posPrice)
Else: trades(ticker).cashVal = trades(ticker).cashVal + lineItems(posQuantity) * lineItems(posPrice)
End If
Else:
If InStr(1, lineItems(posDirection), "B") Then
trades(ticker).cashVal = trades(ticker).cashVal - lineItems(posQuantity) * lineItems(posPrice)
trades(ticker).positionVal = trades(ticker).positionVal + lineItems(posQuantity)
If lineItems(posTime) >= trades(ticker).maxDateVal Then
trades(ticker).maxDateVal = lineItems(posTime)
trades(ticker).endPriceVal = lineItems(posPrice)
End If
Else: trades(ticker).cashVal = trades(ticker).cashVal + lineItems(posQuantity) * lineItems(posPrice)
trades(ticker).positionVal = trades(ticker).positionVal - lineItems(posQuantity)
If lineItems(posTime) >= trades(ticker).maxDateVal Then
trades(ticker).maxDateVal = lineItems(posTime)
trades(ticker).endPriceVal = lineItems(posPrice)
End If
End If
End If
Debug.Print trades(ticker).positionVal
pos = pos + 1
Wend
Dim k As Variant
For Each k In trades.Keys
Debug.Print k, trades(k).cashVal, trades(k).positionVal, trades(k).endPriceVal, trades(k).maxDateVal
Next
End Sub
Edited to Add:
This is what my class objects look like:
'Class Module: Stock
Public symbol As String
Public cashVal As Double
Public positionVal As Double
Public endPriceVal As Double
Public maxDateVal As Date
Does anyone know how to cure this curious problem?
excel vba
I have data in a file like:
TIME|DIRECTION|ORDERID|SYMBOL|ROUTE||QUANTITY|PRICE
2012-05-29 11:17:18|B|1337|ZNGA|ARCA||6500|5.48
2012-05-29 11:17:53|B|1389|AAPL|ARCA||200|569.85
2012-05-29 11:18:22|S|1970|BRK/B|ARCA||600|77.48
2012-05-29 11:18:24|B|2335|BRK/B|ARCA||600|79.3
2012-05-29 11:19:27|B|2416|ZNGA|ARCA||4000|6.08
2012-05-29 11:19:29|S|2997|LNKD|ARCA||500|91.27
2012-05-29 11:19:40|S|3078|ZNGA|ARCA||3900|6.04
I am trying to write VBA code which will consume the data and return statistics based on ticker (cumulative quantity, price, etc.). I have written code using a dictionary object with a class object. This is for an assignment, so I have to do it that way.
If I just run the code, it compiles just fine. The numbers are incorrect (trying to fix that), but the code compiles.
When I add a breakpoint and try to step into the code, it started to do funny things. It ran fine for the first few runs, but it started breaking when I stopped runs/added things etc. If I step into the code, it seems to think that a dictionary object exists when it. So the statement If Not trades.exists(ticker) Then
evaluates as False
. Then it breaks on the line trades(ticker).cashVal = trades(ticker).cashVal - lineItems(posQuantity) * lineItems(posPrice)
when it presumably tries to search for a value but finds none.
The error is: Run-time error '424': Object Required.
Oddly, again, if I run it without the breakpoint it complies just fine.
Sub defineVar()
myFile = Range("$A$2")
End Sub
Public Sub test_everything()
Call defineVar
'Dim line As trade
Dim lines As Collection
Set lines = New Collection
Open myFile For Input As #1
Do Until EOF(1)
Line Input #1, file_line
lines.Add file_line
Loop
Close #1
Dim posTime As Byte
Dim posDirection As Byte
Dim posSymbol As Byte
Dim posQuantity As Byte
Dim posPrice As Byte
posTime = getColPosByHeader("TIME", lines(1))
posDirection = getColPosByHeader("DIRECTION", lines(1))
posSymbol = getColPosByHeader("SYMBOL", lines(1))
posQuantity = getColPosByHeader("QUANTITY", lines(1))
posPrice = getColPosByHeader("PRICE", lines(1))
Dim pos As Long
Dim ticker As String
Dim trades As Scripting.Dictionary
Set trades = New Scripting.Dictionary
Dim trade As Stock
Set trade = New Stock
pos = 2
While pos <= lines.Count
lineItems = Split(lines(pos), "|")
ticker = lineItems(posSymbol)
If Not trades.exists(ticker) Then
trade.symbol = ticker
trade.cashVal = 0
trade.positionVal = lineItems(posQuantity)
trade.endPriceVal = lineItems(posPrice)
trade.maxDateVal = lineItems(posTime)
trades.Add trade.symbol, trade
If InStr(1, lineItems(posDirection), "B") Then
trades(ticker).cashVal = trades(ticker).cashVal - lineItems(posQuantity) * lineItems(posPrice)
Else: trades(ticker).cashVal = trades(ticker).cashVal + lineItems(posQuantity) * lineItems(posPrice)
End If
Else:
If InStr(1, lineItems(posDirection), "B") Then
trades(ticker).cashVal = trades(ticker).cashVal - lineItems(posQuantity) * lineItems(posPrice)
trades(ticker).positionVal = trades(ticker).positionVal + lineItems(posQuantity)
If lineItems(posTime) >= trades(ticker).maxDateVal Then
trades(ticker).maxDateVal = lineItems(posTime)
trades(ticker).endPriceVal = lineItems(posPrice)
End If
Else: trades(ticker).cashVal = trades(ticker).cashVal + lineItems(posQuantity) * lineItems(posPrice)
trades(ticker).positionVal = trades(ticker).positionVal - lineItems(posQuantity)
If lineItems(posTime) >= trades(ticker).maxDateVal Then
trades(ticker).maxDateVal = lineItems(posTime)
trades(ticker).endPriceVal = lineItems(posPrice)
End If
End If
End If
Debug.Print trades(ticker).positionVal
pos = pos + 1
Wend
Dim k As Variant
For Each k In trades.Keys
Debug.Print k, trades(k).cashVal, trades(k).positionVal, trades(k).endPriceVal, trades(k).maxDateVal
Next
End Sub
Edited to Add:
This is what my class objects look like:
'Class Module: Stock
Public symbol As String
Public cashVal As Double
Public positionVal As Double
Public endPriceVal As Double
Public maxDateVal As Date
Does anyone know how to cure this curious problem?
excel vba
excel vba
edited Nov 20 '18 at 19:29
asked Nov 16 '18 at 20:35
thenifthenif
155
155
this is a post where talk about error 424: stackoverflow.com/questions/21358540/…
– Ferdinando
Nov 16 '18 at 20:40
1
If your indentation is where you think theIf
andElse
statements match up, you should run this through an indenter. That said, I don't understand what the dictionary is even for - you're re-using the sameStock
object, so you end up with a single object in the dictionary under each different key.
– Comintern
Nov 16 '18 at 21:08
The idea is that each stock (FB, AAPL, etc) is a different key and returns each statistic for it. The number of unique stocks is unknown in the file. That's what I was trying to build, anyway, but there are bugs. Unfortunately I am having trouble debugging because the code won't compile if I add a breakpoint... If you have suggestions about my other issue though, I will gladly listen!
– thenifthenif
Nov 16 '18 at 22:05
Won't compile, or is throwing a run-time error 424? Those are two completely different things. Can you edit the question to include the code for theStock
class?
– Comintern
Nov 17 '18 at 0:31
Seems like Power Query might be more appropriate to use, depending on what exactly you're trying to achieve. It hasextract, transform, load
capabilities, so it can take structured/delimited data as input, which you can then transform into a table and load to an Excel sheet.
– chillin
Nov 17 '18 at 19:10
|
show 1 more comment
this is a post where talk about error 424: stackoverflow.com/questions/21358540/…
– Ferdinando
Nov 16 '18 at 20:40
1
If your indentation is where you think theIf
andElse
statements match up, you should run this through an indenter. That said, I don't understand what the dictionary is even for - you're re-using the sameStock
object, so you end up with a single object in the dictionary under each different key.
– Comintern
Nov 16 '18 at 21:08
The idea is that each stock (FB, AAPL, etc) is a different key and returns each statistic for it. The number of unique stocks is unknown in the file. That's what I was trying to build, anyway, but there are bugs. Unfortunately I am having trouble debugging because the code won't compile if I add a breakpoint... If you have suggestions about my other issue though, I will gladly listen!
– thenifthenif
Nov 16 '18 at 22:05
Won't compile, or is throwing a run-time error 424? Those are two completely different things. Can you edit the question to include the code for theStock
class?
– Comintern
Nov 17 '18 at 0:31
Seems like Power Query might be more appropriate to use, depending on what exactly you're trying to achieve. It hasextract, transform, load
capabilities, so it can take structured/delimited data as input, which you can then transform into a table and load to an Excel sheet.
– chillin
Nov 17 '18 at 19:10
this is a post where talk about error 424: stackoverflow.com/questions/21358540/…
– Ferdinando
Nov 16 '18 at 20:40
this is a post where talk about error 424: stackoverflow.com/questions/21358540/…
– Ferdinando
Nov 16 '18 at 20:40
1
1
If your indentation is where you think the
If
and Else
statements match up, you should run this through an indenter. That said, I don't understand what the dictionary is even for - you're re-using the same Stock
object, so you end up with a single object in the dictionary under each different key.– Comintern
Nov 16 '18 at 21:08
If your indentation is where you think the
If
and Else
statements match up, you should run this through an indenter. That said, I don't understand what the dictionary is even for - you're re-using the same Stock
object, so you end up with a single object in the dictionary under each different key.– Comintern
Nov 16 '18 at 21:08
The idea is that each stock (FB, AAPL, etc) is a different key and returns each statistic for it. The number of unique stocks is unknown in the file. That's what I was trying to build, anyway, but there are bugs. Unfortunately I am having trouble debugging because the code won't compile if I add a breakpoint... If you have suggestions about my other issue though, I will gladly listen!
– thenifthenif
Nov 16 '18 at 22:05
The idea is that each stock (FB, AAPL, etc) is a different key and returns each statistic for it. The number of unique stocks is unknown in the file. That's what I was trying to build, anyway, but there are bugs. Unfortunately I am having trouble debugging because the code won't compile if I add a breakpoint... If you have suggestions about my other issue though, I will gladly listen!
– thenifthenif
Nov 16 '18 at 22:05
Won't compile, or is throwing a run-time error 424? Those are two completely different things. Can you edit the question to include the code for the
Stock
class?– Comintern
Nov 17 '18 at 0:31
Won't compile, or is throwing a run-time error 424? Those are two completely different things. Can you edit the question to include the code for the
Stock
class?– Comintern
Nov 17 '18 at 0:31
Seems like Power Query might be more appropriate to use, depending on what exactly you're trying to achieve. It has
extract, transform, load
capabilities, so it can take structured/delimited data as input, which you can then transform into a table and load to an Excel sheet.– chillin
Nov 17 '18 at 19:10
Seems like Power Query might be more appropriate to use, depending on what exactly you're trying to achieve. It has
extract, transform, load
capabilities, so it can take structured/delimited data as input, which you can then transform into a table and load to an Excel sheet.– chillin
Nov 17 '18 at 19:10
|
show 1 more comment
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53345023%2fcode-throws-an-error-when-a-breakpoint-is-added-but-not-otherwise%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53345023%2fcode-throws-an-error-when-a-breakpoint-is-added-but-not-otherwise%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
this is a post where talk about error 424: stackoverflow.com/questions/21358540/…
– Ferdinando
Nov 16 '18 at 20:40
1
If your indentation is where you think the
If
andElse
statements match up, you should run this through an indenter. That said, I don't understand what the dictionary is even for - you're re-using the sameStock
object, so you end up with a single object in the dictionary under each different key.– Comintern
Nov 16 '18 at 21:08
The idea is that each stock (FB, AAPL, etc) is a different key and returns each statistic for it. The number of unique stocks is unknown in the file. That's what I was trying to build, anyway, but there are bugs. Unfortunately I am having trouble debugging because the code won't compile if I add a breakpoint... If you have suggestions about my other issue though, I will gladly listen!
– thenifthenif
Nov 16 '18 at 22:05
Won't compile, or is throwing a run-time error 424? Those are two completely different things. Can you edit the question to include the code for the
Stock
class?– Comintern
Nov 17 '18 at 0:31
Seems like Power Query might be more appropriate to use, depending on what exactly you're trying to achieve. It has
extract, transform, load
capabilities, so it can take structured/delimited data as input, which you can then transform into a table and load to an Excel sheet.– chillin
Nov 17 '18 at 19:10