+ Reply to Thread
Results 1 to 8 of 8

The syntax for programmatically inserting a "/" in the middle of a concatenated cell

  1. #1
    akh2103@gmail.com
    Guest

    The syntax for programmatically inserting a "/" in the middle of a concatenated cell

    Hello--Does anyone know the syntax for programatically inserting a "/"
    between the two added numbers of a concatenated cell? I want the value
    of, say, Range("a1") to equal the value of range ("a2") "/" range
    ("a3"). What is the syntax for telling excel to insert the slash?
    A stripped down version of my code looks like this :


    Sub Concat()
    Range("a1").Formula = "=Value(A2&A3)"
    End Sub

    I want the "/" between A2 and A3.

    Does anyone know the syntax?


  2. #2
    Don Guillett
    Guest

    Re: The syntax for programmatically inserting a "/" in the middle of a concatenated cell

    Sub insertslash()
    Range("a1") = Range("a2") & "/" & Range("b2")
    End Sub

    --
    Don Guillett
    SalesAid Software
    dguillett1@austin.rr.com
    <akh2103@gmail.com> wrote in message
    news:1155043063.085201.36750@i3g2000cwc.googlegroups.com...
    > Hello--Does anyone know the syntax for programatically inserting a "/"
    > between the two added numbers of a concatenated cell? I want the value
    > of, say, Range("a1") to equal the value of range ("a2") "/" range
    > ("a3"). What is the syntax for telling excel to insert the slash?
    > A stripped down version of my code looks like this :
    >
    >
    > Sub Concat()
    > Range("a1").Formula = "=Value(A2&A3)"
    > End Sub
    >
    > I want the "/" between A2 and A3.
    >
    > Does anyone know the syntax?
    >




  3. #3
    Zone
    Guest

    Re: The syntax for programmatically inserting a "/" in the middle of a concatenated cell

    [a1] = [a2] & "/" & [a3]

    Note there is a space before and after the &. Of course, you could use
    the Range("A1") notation instead of [a1] if you prefer. James

    akh2103@gmail.com wrote:
    > Hello--Does anyone know the syntax for programatically inserting a "/"
    > between the two added numbers of a concatenated cell? I want the value
    > of, say, Range("a1") to equal the value of range ("a2") "/" range
    > ("a3"). What is the syntax for telling excel to insert the slash?
    > A stripped down version of my code looks like this :
    >
    >
    > Sub Concat()
    > Range("a1").Formula = "=Value(A2&A3)"
    > End Sub
    >
    > I want the "/" between A2 and A3.
    >
    > Does anyone know the syntax?



  4. #4
    akh2103@gmail.com
    Guest

    Re: The syntax for programmatically inserting a "/" in the middle of a concatenated cell

    Hey--Thanks for the help guys. The syntax you gave works for inserting
    characters like 'a' in between the values, but for some reason it is
    still dividing when I try to insert the /. Any ideas about what is
    going on?

    My code, exactly:

    Sub test()

    [a1] = [a11] & "/" & [a9]

    End Sub


  5. #5
    Zone
    Guest

    Re: The syntax for programmatically inserting a "/" in the middle of a concatenated cell

    The code works fine for me. I cannot see how the two numbers are being
    divided unless A1 begins with =. Check A1 and make sure it doesn't
    begin with =. Then post back. Maybe Don has an idea. James

    akh2103@gmail.com wrote:
    > Hey--Thanks for the help guys. The syntax you gave works for inserting
    > characters like 'a' in between the values, but for some reason it is
    > still dividing when I try to insert the /. Any ideas about what is
    > going on?
    >
    > My code, exactly:
    >
    > Sub test()
    >
    > [a1] = [a11] & "/" & [a9]
    >
    > End Sub



  6. #6
    Don Guillett
    Guest

    Re: The syntax for programmatically inserting a "/" in the middle of a concatenated cell

    Sub insertslash()
    With Range("A1")
    ..NumberFormat = "# ?/?"
    ..Value = Range("a2") & "/" & Range("b2")
    End With
    End Sub

    --
    Don Guillett
    SalesAid Software
    dguillett1@austin.rr.com
    <akh2103@gmail.com> wrote in message
    news:1155045617.171385.315710@h48g2000cwc.googlegroups.com...
    > Hey--Thanks for the help guys. The syntax you gave works for inserting
    > characters like 'a' in between the values, but for some reason it is
    > still dividing when I try to insert the /. Any ideas about what is
    > going on?
    >
    > My code, exactly:
    >
    > Sub test()
    >
    > [a1] = [a11] & "/" & [a9]
    >
    > End Sub
    >




  7. #7
    akh2103@gmail.com
    Guest

    Re: The syntax for programmatically inserting a "/" in the middle of a concatenated cell

    The trouble was that the cells were in a custom format. I changed the
    format to text ("@") and the problem went away. Thanks for all the
    help! -Abe


    Don Guillett wrote:
    > Sub insertslash()
    > With Range("A1")
    > .NumberFormat = "# ?/?"
    > .Value = Range("a2") & "/" & Range("b2")
    > End With
    > End Sub
    >
    > --
    > Don Guillett
    > SalesAid Software
    > dguillett1@austin.rr.com
    > <akh2103@gmail.com> wrote in message
    > news:1155045617.171385.315710@h48g2000cwc.googlegroups.com...
    > > Hey--Thanks for the help guys. The syntax you gave works for inserting
    > > characters like 'a' in between the values, but for some reason it is
    > > still dividing when I try to insert the /. Any ideas about what is
    > > going on?
    > >
    > > My code, exactly:
    > >
    > > Sub test()
    > >
    > > [a1] = [a11] & "/" & [a9]
    > >
    > > End Sub
    > >



  8. #8
    Don Guillett
    Guest

    Re: The syntax for programmatically inserting a "/" in the middle of a concatenated cell

    glad to help

    --
    Don Guillett
    SalesAid Software
    dguillett1@austin.rr.com
    <akh2103@gmail.com> wrote in message
    news:1155242816.360845.165320@i3g2000cwc.googlegroups.com...
    > The trouble was that the cells were in a custom format. I changed the
    > format to text ("@") and the problem went away. Thanks for all the
    > help! -Abe
    >
    >
    > Don Guillett wrote:
    >> Sub insertslash()
    >> With Range("A1")
    >> .NumberFormat = "# ?/?"
    >> .Value = Range("a2") & "/" & Range("b2")
    >> End With
    >> End Sub
    >>
    >> --
    >> Don Guillett
    >> SalesAid Software
    >> dguillett1@austin.rr.com
    >> <akh2103@gmail.com> wrote in message
    >> news:1155045617.171385.315710@h48g2000cwc.googlegroups.com...
    >> > Hey--Thanks for the help guys. The syntax you gave works for inserting
    >> > characters like 'a' in between the values, but for some reason it is
    >> > still dividing when I try to insert the /. Any ideas about what is
    >> > going on?
    >> >
    >> > My code, exactly:
    >> >
    >> > Sub test()
    >> >
    >> > [a1] = [a11] & "/" & [a9]
    >> >
    >> > End Sub
    >> >

    >




+ 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