Author Posts

April 22, 2016 at 2:44 pm

Hi All,

I am formatting an excel workbook
I want to insert 2 new columns after column B

Is this possible to accomplish this?
I have tried below code its not working

$range = $WorkSheet.Range("B").EntireColumn
$range.Insert($xlShiftToRight)

any help or pointer would be really helpful

Thank you have a good weekend.

-Vishal

April 22, 2016 at 2:52 pm

This code is adding new columns
its giving me what I am trying to accomplish.

$range = $WorkSheet.Range("B:B").EntireColumn
$range.Insert($xlShiftToRight)
$range.Insert($xlShiftToRight)

Wondering if there is a better way to do this

-Vishal