Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    552
    Thanks
    0
    Thanked 1 Time in 1 Post

    Add 'n=' to an ActiveCell (officexp, win 2000)

    I have a cell with the number 317 in it. I want to add n = before the 317 so it become n = 317. How do i do this using vba? Thanks

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Add 'n=' to an ActiveCell (officexp, win 2000)

    If the cell is A1 on worksheet Sheet1, then:

    <pre> Worksheets("Sheet1").Range("A1").Value = "n=" & Worksheets("Sheet1").Range("A1").Value
    </pre>


    If you really meant the active cell as the subject says, then:

    <pre> ActiveCell.Value = "n=" & ActiveCell.Value
    </pre>

    Legare Coleman

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Add 'n=' to an ActiveCell (officexp, win 2000)

    However, in either case, you no longer have a number, you have a string.
    Charlotte

  4. #4
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Add 'n=' to an ActiveCell (officexp, win 2000)

    In order to keep the 317 in the cell as a number, I would just change the format:
    <pre> Selection.NumberFormat = """n=""General"
    </pre>

    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •