Replace data in a whole column as Excel

Welcome Forums General PowerShell Q&A Replace data in a whole column as Excel

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

 
Participant
3 years, 7 months ago.

  • Author
    Posts
  • #26458

    Participant
    Points: 1
    Rank: Member

    Hello,
    I'm new in Powershell.
    Well, with Excel I can select a column and repalce multi characters in 1 second. I would like to do the same thing with Powershell. With Excel it looks like this :

    Sub Macro1()
        Columns("B:B").Select
        Selection.Replace What:=" on ", Replacement:=";", LookAt:=xlPart, _
            SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
            ReplaceFormat:=False
    End Sub
    

    I know how to do it when it is like this : (what:="\"), but not for " on " (with space before and after "on".
    Could you please help me ?

  • #26459

    Participant
    Points: 1
    Rank: Member

    This was two days I was looking, I found, here is the solution:

     $ range.EntireColumn.Replace ('on', ';') 

    .
    Thank you.

The topic ‘Replace data in a whole column as Excel’ is closed to new replies.