PowerShell for Windows Admins

Jul 5 2013   12:56PM GMT

Excel–named range



Posted by: Richard Siddaway
Tags:
Office 2013
PowerShell 3

To create a named range in an Excel spreadsheet

$xl = New-Object -ComObject ‘Excel.Application’
$wkbk = $xl.Workbooks.Add()
$sheet = $wkbk.WorkSheets.Item(1)
$range = $xl.Range(“A1″, “D4″)
$range.Name = “Test”

Just to show how to work with named ranges

$range2 = $xl.Range(“Test”)
$range2.Borders.Color=0
$range2.Borders.ColorIndex=26
$range2.Borders.Weight=2
$xl.visible = $true

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: