Add new column to Excel sheet

This topic contains 1 reply, has 1 voice, and was last updated by Profile photo of Vishal Rao B Vishal Rao B 7 months, 2 weeks ago.

  • Author
    Posts
  • #38187
    Profile photo of Vishal Rao B
    Vishal Rao B
    Participant

    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
    Profile photo of Vishal Rao B
    Vishal Rao B
    Participant

    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

You must be logged in to reply to this topic.