Happy 7/4 in advance!
I don't know if the following questions are necessary for a solid grasp of VBA, but I'll take whatever help I can get, after spending hours trying to decipher these. Please just ignore anything you find too silly! So much obliged for the feedback friends, as always. Starting with the most straightforward (and ending with a not so much one):
1) What's the difference between arrays and array functions? I believe they are both variants, except that it seems that the latter allows easier element assignment (at least for single dimensions).
2) I saw an example where it says Dim MyMatrix(1 To 5, 4 To 9, 3 To 5) As Double. From some simple testing, this seems to be a basic 3D array where some of the bounds don't start at 0 (or 1) (e.g., element MyMatrix(5,3,3) doesn't exist). I was curious if there will ever be a practical situation where you number these bounds similar to these?
3) Suppose that cells A2, A3 and A4 all contain {=ROW(C4:D6)}. What does that mean exactly?
4) I had created a simple sub which just assigns a Rnd (or Rand) random number to a few columns of cells. Now, one can assign a button to activate a macro to reset the numbers, if there were prior ones. I apologize for not having the actual code, but there was a recent situation where I can also reset the code by simply clicking on the same column of where those cells were. Is this a default setting?
5) This is actually an observation of a simple Sub that changes any chart into a line chart.
I just found it interesting that there's a built-in object or property off a user-created variable (although I guess in this case, that variable is based on the built-in ChartObject).
6) I was hoping for a simple example where we can avoid using the Set statement, by using the New keyword in the Dim statement, e.g., Dim X As New Worksheet?
(Looking up their respective definitions for each (italics) in Excel Help only created more questions for me (e.g. does it matter that an unassigned object is new to be considered as empty; implicit object creation, which I'm still shaky on, despite its usage in C# and C++; all the shared keywords in their syntax; etc.) so I want to keep it simple for now).
I don't know if the following questions are necessary for a solid grasp of VBA, but I'll take whatever help I can get, after spending hours trying to decipher these. Please just ignore anything you find too silly! So much obliged for the feedback friends, as always. Starting with the most straightforward (and ending with a not so much one):
1) What's the difference between arrays and array functions? I believe they are both variants, except that it seems that the latter allows easier element assignment (at least for single dimensions).
2) I saw an example where it says Dim MyMatrix(1 To 5, 4 To 9, 3 To 5) As Double. From some simple testing, this seems to be a basic 3D array where some of the bounds don't start at 0 (or 1) (e.g., element MyMatrix(5,3,3) doesn't exist). I was curious if there will ever be a practical situation where you number these bounds similar to these?
3) Suppose that cells A2, A3 and A4 all contain {=ROW(C4:D6)}. What does that mean exactly?
4) I had created a simple sub which just assigns a Rnd (or Rand) random number to a few columns of cells. Now, one can assign a button to activate a macro to reset the numbers, if there were prior ones. I apologize for not having the actual code, but there was a recent situation where I can also reset the code by simply clicking on the same column of where those cells were. Is this a default setting?
5) This is actually an observation of a simple Sub that changes any chart into a line chart.
Rich (BB code):
Sub ChangeCharts()
Dim Cht As ChartObject
For Each Cht In Sheets("Sheet1").ChartObjects
Cht.Chart.ChartType = xlLine
Next Cht
End Sub
6) I was hoping for a simple example where we can avoid using the Set statement, by using the New keyword in the Dim statement, e.g., Dim X As New Worksheet?
(Looking up their respective definitions for each (italics) in Excel Help only created more questions for me (e.g. does it matter that an unassigned object is new to be considered as empty; implicit object creation, which I'm still shaky on, despite its usage in C# and C++; all the shared keywords in their syntax; etc.) so I want to keep it simple for now).