|
-
May 17th, 2005, 05:36 PM
#1
Thread Starter
Hyperactive Member
Confusing Piece of VBA Code
I'm trying to come to grips with someone else's spreadsheet and am having trouble with some of the VBA code. Here is an example of it (the original is similar to this just a lot longer):
Code:
Public Sub Set_Z2()
Z2(1, 1, 0) = 5
Z2(1, 1, 1) = 0.62
Z2(1, 1, 2) = 0.79
Z2(1, 1, 3) = 0.89
Z2(1, 1, 4) = 0.97
Z2(1, 1, 5) = 1.02
End Sub
The part I don't understand is the bit in brackets. "Z2" is (I'm pretty sure) supposed to be a variable but why is it followed by 3 numbers in brackets?
Cheers
-Rob
http://www.sudsolutions.com
-
May 17th, 2005, 05:40 PM
#2
Re: Confusing Piece of VBA Code
Its a 3 dimensional array. How is it defined - dynamic bounds or is it a static declaration of elements? What type double?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 17th, 2005, 05:48 PM
#3
Thread Starter
Hyperactive Member
Re: Confusing Piece of VBA Code
Code:
Public Z2(1 To 2, 1 To 12, 0 To 5) As Single
There's also this bit:
Code:
Public summer(100) As Single
Public Winter(100) As Single
So I take it that means that this declares two variables (summer and winter) as Single variables but also as arrays with 100 (or 101?) elements?
http://www.sudsolutions.com
-
May 17th, 2005, 06:34 PM
#4
Re: Confusing Piece of VBA Code
Yes, 101 unless you have an Option Base 1 statement at the top of the class/module.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|