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
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

This month, every Windows Secrets subscriber can download a one-chapter excerpt of Windows 7: The Missing Manual.Windows 7: The Missing Manual provides valuable information to help you overcome these difficulties in learning a new operating system. Subscribe today to download your free excerpt.
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
However, in either case, you no longer have a number, you have a string.
Charlotte
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>