Add new column to Excel sheet

Welcome Forums General PowerShell Q&A Add new column to Excel sheet

This topic contains 1 reply, has 1 voice, and was last updated by

 
Participant
2 years, 7 months ago.

  • Author
    Posts
  • #38187

    Participant
    Points: 0
    Rank: Member

    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

  • #38188

    Participant
    Points: 0
    Rank: Member

    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

The topic ‘Add new column to Excel sheet’ is closed to new replies.