Multiply PasteSpecial excel function with Powershell

This topic contains 2 replies, has 1 voice, and was last updated by Profile photo of Vishal Rao B Vishal Rao B 5 months, 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #38223
    Profile photo of Vishal Rao B
    Vishal Rao B
    Participant

    Hi All,

    I have excel workbook with rows, that are in text format. I manually multiply with '1' to get them into Number format.

    I am trying to accomplish this with powrshell script
    Any help on this appreciated.

    -Vishal

    #38224
    Profile photo of Vishal Rao B
    Vishal Rao B
    Participant

    I Have tried to follow instructions as mentioned here, but I am still getting error

    Range(“A2").PasteSpecial( -4163 , 4 )

    https://github.com/OfficeDev/VBA-content/blob/master/Excel-VBA/articles/d3e991f2-7ef7-2ebc-d4bc-ba4c26be472e.md

    Unable to find type [Microsoft.Office.Interop.Excel.xlPasteSpecialOperationMultiply]. Make sure that the assembly that contains this type is loaded.
    At line:1 char:1
    + [void]$workSheet.Range(“A2").PasteSpecial([Microsoft.Office.Interop.Excel.XlPast ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (Microsoft.Offic...erationMultiply:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound

    #38225
    Profile photo of Vishal Rao B
    Vishal Rao B
    Participant

    Its working now
    $rows = $WorkSheet.range("A2").currentregion.rows.count
    $WorkSheet.Range(“B2”).Copy()
    $workSheet.Range("A2:A$Rows”).PasteSpecial( -4163 , 4 )

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.