+ Reply to Thread
Results 1 to 3 of 3

If statement user created function

  1. #1
    Registered User
    Join Date
    08-27-2007
    Posts
    22

    If statement user created function

    so I am so new to VB it's lame but I have the following code

    Please Login or Register  to view this content.
    My question is I know it's not correct. "x" is going to be a cell in the range C11:C96 from the provided worksheet. C11:C96 will eventually be referenced on worksheet1 in column A.

    So I'm trying to make this work but I have no idea how to make excel let me use this function nor do I know if the code is correct.

    can anyone help me out?

    Thanks a million
    Attached Files Attached Files

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887
    Hi demuro,

    Try this function code in a standard module (open VB Editor, click Insert -> Module, paste the code shown below). In your worksheet, use the formula

    =Adjust(C11) (or any other cell reference)

    Note that if you change A16 or A29, you'll have to perform a full sheet calculation (CTRL+ALT+SHIFT+F9) for any existing '=Adjust()' formulas to update properly. Also note that because you used ">" and "<" (not ">=" and "<=") there are gaps in the ranges, e.g. 21-85, 88-452.. what happens if the value is 86 or 87? The way it's coded, it will stay 86 or 87. If you need to adjust the code to be all-inclusive of the consecutive ranges, just change the numbers in the Case statements as necessary.
    Please Login or Register  to view this content.
    Last edited by Paul; 10-11-2008 at 12:59 AM.

  3. #3
    Registered User
    Join Date
    08-27-2007
    Posts
    22
    are you saying that the values wont automatically recalculate? is there any way to have them recalculate every time I make a selection? Maybe something I could place in the function to have it automatically recalculate

    also thanks so much for the help, I hope my code was at least passable. Yours works perfectly I just need to see if there's a way to have it recalculate now.

    Thanks again
    Last edited by demuro1; 10-11-2008 at 03:25 PM.

+ 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. Using the 'NOW' function within an 'IF' statement
    By rminns in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-12-2011, 04:01 PM
  2. Modify a Function to add an extra condition
    By King_Quake in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-03-2008, 04:32 PM
  3. User that created worksheet?
    By artolder in forum Excel General
    Replies: 2
    Last Post: 06-30-2008, 12:56 PM
  4. Compare user input with range (with an if statement)
    By HBF in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-24-2008, 11:35 AM
  5. Link together different cells in specific order?
    By Sandman4432 in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 01-03-2008, 05:01 AM

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