Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 3 of 3

Thread: Public Function VBA #VALUE Error

  1. #1
    Join Date
    6th August 2011
    Posts
    1

    Public Function VBA #VALUE Error

    Hi,

    I have created a simple Public Function (to be expanded) but want to make sure I can get the call in excel working. Here is the code:

    VB:
    Public Function Wind (Direction As Integer) As Integer 
         
        If Direction > 0 & Direction <=10 Then Wind = 1 
    Else: Wind = 0 
    End If 
     
    End Public Function 
    
    
    Essentially Direction is a numeric value for wind direction and i am seeing if it is between 0 and 10. When i type the following in excel [code] =Wind (A1) it returns #VALUE
    Any help would be appreciated
    Last edited by AAE; August 6th, 2011 at 07:49. Reason: add code tags

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    29th June 2011
    Location
    United States
    Posts
    737

    Re: Public Function VBA #VALUE Error

    You need to put you VBA code into code tags

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    19th January 2007
    Location
    South Carolina, USA
    Posts
    9,206

    Re: Public Function VBA #VALUE Error

    Hello oasiscolts18,

    Welcome to Ozgrid.
    While we're glad to have you on board, please take the time to read the forum rules.

    All VBA code posted in the forum must be wrapped in code tags, which you omitted, including single-line code snippets.
    I've added the tags for you this time only. Be sure to use them in future posts.

    How to use code tags

    [code]
    your code goes between these tags
    [/code]
    ---------------------------------------------------------


    VB:
    Option Explicit 
     
    Public Function Wind(Direction As Long) As Integer 
         
        If Direction > 0 And Direction <= 10 Then 
            Wind = 1 
        Else 
            Wind = 0 
        End If 
         
    End Function 
    
    
    AAE
    ----------------------------------------------------

    Forum Rules | Message to Cross Posters | How to use Tags

Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Get Response From Public Function
    By Crysallis in forum Excel and/or Access Help
    Replies: 3
    Last Post: June 19th, 2007, 09:13
  2. "wrong Data Type Error" Public Lookup Function
    By XLeary in forum Excel and/or SQL Help
    Replies: 5
    Last Post: May 4th, 2007, 04:48
  3. "wrong Data Type Error" Public Lookup Function
    By XLeary in forum EXCEL HELP
    Replies: 2
    Last Post: May 4th, 2007, 01:27
  4. public function
    By bisjom in forum EXCEL HELP
    Replies: 8
    Last Post: February 23rd, 2005, 11:20
  5. VBA: Public Function IsStrikeThrough(rng As Range)
    By alienscript in forum EXCEL HELP
    Replies: 2
    Last Post: November 25th, 2003, 18:37

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
  •  
porno