0

I'm attempting to add specific text to a cell in an Excel sheet using Powershell. For example:

$1,500/$2,500

The closest I can get to adding that text into a cell with the proper formatting is to remove the characters: 1500/2500. I've tried treating the cell as text and entering it as a formula.

Does not work:

$wb.Sheets(1).Range("G9").Formula = "=""$1,500""&""/""&""$2,500"""

Or

$wb.Sheets(1).Range("G9").NumberFormat = "@"
$wb.Sheets(1).Range("G9").Value = "$1,500/$2,000"
0

1 Answer 1

1

Use single quotes instead of double:

$wb.Sheets(1).Range("G9").Value = '$1,500/$2,000'

You can eliminate the $wb.Sheets(1).Range("G9").NumberFormat = "@" as well. It is not necessary to change the cell formatting to text.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.