+ Reply to Thread
Results 1 to 3 of 3

Excel/VBA declaration of variables

  1. #1
    Registered User
    Join Date
    08-27-2017
    Location
    Modesto, CA
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    91

    Excel/VBA declaration of variables

    Here is my code

    Function Blah(InputArray)

    If TypeName(InputArray) = "Boolean()" then
    Dim outputArray() As Boolean
    Elseif TypeName(InputArray) = "Date()" then
    Dim outputArray() As Date
    End If

    I get an error message on the Dim outputArray() As Date line: "Duplicate declaration in current scope"

    How do I do what I am obviously trying to do?

    Thanks.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,594

    Re: Excel/VBA declaration of variables

    Welcome to the forum!

    Unfortunately, your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,336

    Re: Excel/VBA declaration of variables

    Hi Alan

    In future please view the forum rules before posting. Your post does not comply with rule #3.
    3. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the [#] button at the top of the post window.
    Unfortunately we are unable to assist until this has been resolved...Edit post 1, Highlight your code and click the [#] button at the top of the post window.
    Last edited by sintek; 12-01-2017 at 02:11 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Excel VBA creating Range from set cell, variable declaration wrong
    By Simone Fick in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-12-2017, 05:32 PM
  2. Replies: 9
    Last Post: 05-21-2017, 10:44 PM
  3. [SOLVED] Combination of declaration variables for both workbook & worksheet
    By Faridwahidi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-18-2017, 12:31 PM
  4. [SOLVED] Variables declaration
    By nikolaygeorgiev in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-27-2013, 11:15 AM
  5. Excel 2007 - Enum declaration causes Out of Memory msg
    By bigclems in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-17-2010, 11:48 AM
  6. Declaration name
    By Robert Hargreaves in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-06-2005, 12:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1