Hi everyone I am writing a script in VBA to pull issues from my server and populate it into Excel. Everything is working the only problem being I have to manually enter the number of elements in the for-loop that there are (in this case there are three issues/ids on the website so "3" is the number in the for-loop). If I switch 3 for 10 in the for-loop for example it throws me a "Run-time error '9' Subscript out of range" error. Does anyone know how I can make the range automatically match the number of issues/id in the webpage without me having to manually type the number each time? I am using this JSON parser: https://github.com/VBA-tools/VBA-JSON
Hi @Marcus_Dyer ,
I use Json("issues").Count. Here is an example:
Set Json = JsonConverter.ParseJson(.responseText)
For index_issues = 1 To Json("issues").Count
'do something
Next index_issues
asd
BTW calculations shouldn't be used in loop ranges because they are calculated with every iteration. It should be assigned to a variable (which obviously I don't use ;))
Best,
Michael
Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!
Register todayOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.