+ Reply to Thread
Results 1 to 3 of 3

Concatenate with Underscore in formula

  1. #1
    CLR
    Guest

    Concatenate with Underscore in formula

    Hi All.....

    I am trying to use VBA to place a formula in a cell that is a concatenation
    of two cells using an underscore between them. The formula works fine when
    used on the sheet, but VBA balks at the underscores.......is there some
    special combination of characters to allow the underscore.....

    My code reads something like this

    formula = "=A1&"_"&B1"

    Any help would be appreciated,
    Vaya con Dios,
    Chuck, CABGx3








  2. #2
    Tom Ogilvy
    Guest

    Re: Concatenate with Underscore in formula

    I think you problem is not with the underscore, but trying to embed double
    quotes within you string

    formula = "=A1&""_""&B1"
    ? formula
    =A1&"_"&B1



    so double your double quotes when used within a string

    --
    Regards,
    Tom Ogilvy


    "CLR" <[email protected]> wrote in message
    news:[email protected]...
    > Hi All.....
    >
    > I am trying to use VBA to place a formula in a cell that is a

    concatenation
    > of two cells using an underscore between them. The formula works fine

    when
    > used on the sheet, but VBA balks at the underscores.......is there some
    > special combination of characters to allow the underscore.....
    >
    > My code reads something like this
    >
    > formula = "=A1&"_"&B1"
    >
    > Any help would be appreciated,
    > Vaya con Dios,
    > Chuck, CABGx3
    >
    >
    >
    >
    >
    >
    >




  3. #3
    CLR
    Guest

    Re: Concatenate with Underscore in formula

    Cool Tom.........thanks many bunches, that solved the problem. My actual
    formula was a long IF-VLOOKUP string and also included a null "" thing that
    needed the same treatment.

    I much appreciate your help......

    Vaya con Dios,
    Chuck, CABGx3



    "Tom Ogilvy" wrote:

    > I think you problem is not with the underscore, but trying to embed double
    > quotes within you string
    >
    > formula = "=A1&""_""&B1"
    > ? formula
    > =A1&"_"&B1
    >
    >
    >
    > so double your double quotes when used within a string
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "CLR" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hi All.....
    > >
    > > I am trying to use VBA to place a formula in a cell that is a

    > concatenation
    > > of two cells using an underscore between them. The formula works fine

    > when
    > > used on the sheet, but VBA balks at the underscores.......is there some
    > > special combination of characters to allow the underscore.....
    > >
    > > My code reads something like this
    > >
    > > formula = "=A1&"_"&B1"
    > >
    > > Any help would be appreciated,
    > > Vaya con Dios,
    > > Chuck, CABGx3
    > >
    > >
    > >
    > >
    > >
    > >
    > >

    >
    >
    >


+ 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