4

I spent two hours trying to figure out why VBA was giving me the correct values when I used debug.print, but not when I got the returned from the function.

I MISSPENT THE GOOD DAMN FUNCTION IN THE RETURN AND VBA DOESN'T SHOW OR AS A BUG OR GOOD DAMN ANYTHING....

I hate this thing so much.

On the bright side the office thinks I'm some sort of magical tech-deity.

Comments
  • 1
    For those who don't know, return values from functions are stupidly returned by assigning to the function name:

    Function Square(X as Integer)
    Square = X * X
    End Function

    If you misspell the function name, that just creates a new variable with that name.
  • 1
    @polaroidkidd, does VBA not have Option Explicit?
  • 0
    @configurator oh my god thank you! I'm new to VBA. Do you have any other tips or tricks up your sleeve? I'm using the rubber duck extension. Any others you would recommend by chance?
  • 1
    @polaroidkidd unfortunately nope. I never actually worked in VBA except writing a few tiny Excel macros, though I do have some VB experience in my distant past. VBA is different than VB, but mostly similar enough.

    If you do get stuck on something specific with VBA, I'm usually happy to help - email me or find me on Hangouts if you need some help.
  • 1
Add Comment