+ Reply to Thread
Results 1 to 6 of 6

Online reference available for x-fering functions into VB?

Hybrid View

  1. #1
    RAP
    Guest

    Online reference available for x-fering functions into VB?

    Hello, Folks

    I'm fairly adept at developing answers to my problems using worksheet
    functions as long as they're entered into cells. Getting the same
    functionality while using VB is a whole new ball of wax for me. Is there an
    on-line reference you can recommend for this? My reference books simply do
    not address my needs.

    Ex: How do I write VB script to nest the AND and IF worksheet functions?

    Thank you,
    Randy

  2. #2
    Tom Ogilvy
    Guest

    Re: Online reference available for x-fering functions into VB?

    ActiveCell.Formula = "=If(AND(A1=""Snore"",B1=5),""House"",""Dog"")"

    other than that, you wouldn't be nesting worksheet functions in VB.

    Perhaps you can clarify your question if that isn't what you were looking
    for.

    --
    Regards,
    Tom Ogilvy

    "RAP" <RAP@discussions.microsoft.com> wrote in message
    news:6BB5EA54-2747-4CB0-9021-BBE132F6D552@microsoft.com...
    > Hello, Folks
    >
    > I'm fairly adept at developing answers to my problems using worksheet
    > functions as long as they're entered into cells. Getting the same
    > functionality while using VB is a whole new ball of wax for me. Is there

    an
    > on-line reference you can recommend for this? My reference books simply

    do
    > not address my needs.
    >
    > Ex: How do I write VB script to nest the AND and IF worksheet functions?
    >
    > Thank you,
    > Randy




  3. #3
    RAP
    Guest

    Re: Online reference available for x-fering functions into VB?

    Tom,

    Thanks for the reply. I'm just having a difficult time with VB Syntax
    because my references aren't for 2003. I guess it changes from version to
    version. And, being fairly new to VB doesn't help either.
    I'm sure what you sent will be a big help. I'm compiling lots of things
    that interest me from this newsgroup. I'd be a dead duck if it weren't for
    you guys and this newsgroup. Maybe one day I can actually help someone out
    by answering a question, instead of being a "taker" all the time. Thanks
    again. - Randy

    "Tom Ogilvy" wrote:

    > ActiveCell.Formula = "=If(AND(A1=""Snore"",B1=5),""House"",""Dog"")"
    >
    > other than that, you wouldn't be nesting worksheet functions in VB.
    >
    > Perhaps you can clarify your question if that isn't what you were looking
    > for.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "RAP" <RAP@discussions.microsoft.com> wrote in message
    > news:6BB5EA54-2747-4CB0-9021-BBE132F6D552@microsoft.com...
    > > Hello, Folks
    > >
    > > I'm fairly adept at developing answers to my problems using worksheet
    > > functions as long as they're entered into cells. Getting the same
    > > functionality while using VB is a whole new ball of wax for me. Is there

    > an
    > > on-line reference you can recommend for this? My reference books simply

    > do
    > > not address my needs.
    > >
    > > Ex: How do I write VB script to nest the AND and IF worksheet functions?
    > >
    > > Thank you,
    > > Randy

    >
    >
    >


  4. #4
    Tom Ogilvy
    Guest

    Re: Online reference available for x-fering functions into VB?

    VB(A) doesn't really change from version to version. There may be some
    additions, rarely any deletions, but things written in earlier versions
    generally run in later versions.

    --
    Regards,
    Tom Ogilvy

    "RAP" <RAP@discussions.microsoft.com> wrote in message
    news:1E867456-3A6F-424A-9B99-82BCA70CB108@microsoft.com...
    > Tom,
    >
    > Thanks for the reply. I'm just having a difficult time with VB Syntax
    > because my references aren't for 2003. I guess it changes from version to
    > version. And, being fairly new to VB doesn't help either.
    > I'm sure what you sent will be a big help. I'm compiling lots of things
    > that interest me from this newsgroup. I'd be a dead duck if it weren't

    for
    > you guys and this newsgroup. Maybe one day I can actually help someone

    out
    > by answering a question, instead of being a "taker" all the time. Thanks
    > again. - Randy
    >
    > "Tom Ogilvy" wrote:
    >
    > > ActiveCell.Formula = "=If(AND(A1=""Snore"",B1=5),""House"",""Dog"")"
    > >
    > > other than that, you wouldn't be nesting worksheet functions in VB.
    > >
    > > Perhaps you can clarify your question if that isn't what you were

    looking
    > > for.
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > > "RAP" <RAP@discussions.microsoft.com> wrote in message
    > > news:6BB5EA54-2747-4CB0-9021-BBE132F6D552@microsoft.com...
    > > > Hello, Folks
    > > >
    > > > I'm fairly adept at developing answers to my problems using worksheet
    > > > functions as long as they're entered into cells. Getting the same
    > > > functionality while using VB is a whole new ball of wax for me. Is

    there
    > > an
    > > > on-line reference you can recommend for this? My reference books

    simply
    > > do
    > > > not address my needs.
    > > >
    > > > Ex: How do I write VB script to nest the AND and IF worksheet

    functions?
    > > >
    > > > Thank you,
    > > > Randy

    > >
    > >
    > >




  5. #5
    K Dales
    Guest

    RE: Online reference available for x-fering functions into VB?

    You need to think of VB as instructions rather than a function that gives a
    result (of course you can build a function out of VB instructions).

    In VB code you make a basic IF statement:
    IF Condition THEN...

    Now you can think of Condition as one condition or as a combination of
    several (that in the end give either a true/false result). If several you
    would write

    IF condition1 AND/OR condition2 AND/OR condition3 AND/OR condition 4 ...

    The order of the conditions is important since you can come to different
    results depending on how it is interpreted; for example
    True OR False AND False
    could be interpreted as either (True AND False) OR False, which would be
    False, or as True OR (False AND False), which is True. VB will evaluate left
    to right unless directed otherwise by brackets (it will do whatever is inside
    the innermost brackets first). Whenever there is potential for confusion -
    even my own confusion, not VB's! - I use brackets to make my intentions clear.

    So, in the end, I might write:

    IF ((Range("A1").Value = 100) AND ((Range("B1").Value<=Date) OR
    (Range("C1").Value=True)) Then...

    My response should show that VB is conceptually very different from
    worksheet functions; VB works in discrete and very detailed steps where you
    need to assemble the pieces, whereas worksheet functions do most of the work
    for you if you only know how to supply the parameters. For that reason I am
    doubtful any reference exists that tries to go from one to the other; I think
    you would do better learning VB from scratch (there are many references
    available), without thinking about worksheet functions yet. In the end it
    all comes together.
    --
    - K Dales


    "RAP" wrote:

    > Hello, Folks
    >
    > I'm fairly adept at developing answers to my problems using worksheet
    > functions as long as they're entered into cells. Getting the same
    > functionality while using VB is a whole new ball of wax for me. Is there an
    > on-line reference you can recommend for this? My reference books simply do
    > not address my needs.
    >
    > Ex: How do I write VB script to nest the AND and IF worksheet functions?
    >
    > Thank you,
    > Randy


  6. #6
    RAP
    Guest

    RE: Online reference available for x-fering functions into VB?

    K Dale,

    Thanks for the input. I'm definitely quite a ways from "in the end it'll
    all come together." ha! Thanks for the info and the encouragement.

    Randy




    "K Dales" wrote:

    > You need to think of VB as instructions rather than a function that gives a
    > result (of course you can build a function out of VB instructions).
    >
    > In VB code you make a basic IF statement:
    > IF Condition THEN...
    >
    > Now you can think of Condition as one condition or as a combination of
    > several (that in the end give either a true/false result). If several you
    > would write
    >
    > IF condition1 AND/OR condition2 AND/OR condition3 AND/OR condition 4 ...
    >
    > The order of the conditions is important since you can come to different
    > results depending on how it is interpreted; for example
    > True OR False AND False
    > could be interpreted as either (True AND False) OR False, which would be
    > False, or as True OR (False AND False), which is True. VB will evaluate left
    > to right unless directed otherwise by brackets (it will do whatever is inside
    > the innermost brackets first). Whenever there is potential for confusion -
    > even my own confusion, not VB's! - I use brackets to make my intentions clear.
    >
    > So, in the end, I might write:
    >
    > IF ((Range("A1").Value = 100) AND ((Range("B1").Value<=Date) OR
    > (Range("C1").Value=True)) Then...
    >
    > My response should show that VB is conceptually very different from
    > worksheet functions; VB works in discrete and very detailed steps where you
    > need to assemble the pieces, whereas worksheet functions do most of the work
    > for you if you only know how to supply the parameters. For that reason I am
    > doubtful any reference exists that tries to go from one to the other; I think
    > you would do better learning VB from scratch (there are many references
    > available), without thinking about worksheet functions yet. In the end it
    > all comes together.
    > --
    > - K Dales
    >
    >
    > "RAP" wrote:
    >
    > > Hello, Folks
    > >
    > > I'm fairly adept at developing answers to my problems using worksheet
    > > functions as long as they're entered into cells. Getting the same
    > > functionality while using VB is a whole new ball of wax for me. Is there an
    > > on-line reference you can recommend for this? My reference books simply do
    > > not address my needs.
    > >
    > > Ex: How do I write VB script to nest the AND and IF worksheet functions?
    > >
    > > Thank you,
    > > Randy


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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