Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save agbishara/10743689 to your computer and use it in GitHub Desktop.

Select an option

Save agbishara/10743689 to your computer and use it in GitHub Desktop.
This is good if you need to quickly replace text in a workbook for a report
Sub FnR(sWhat As String, sReplacment As String, ws As Worksheet)
ws.UsedRange.Replace What:=sWhat, Replacement:=sReplacment, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
ws.PageSetup.CenterHeader = Replace(ws.PageSetup.CenterHeader, sWhat, sReplacment)
ws.PageSetup.LeftHeader = Replace(ws.PageSetup.LeftHeader, sWhat, sReplacment)
ws.PageSetup.RightHeader = Replace(ws.PageSetup.RightHeader, sWhat, sReplacment)
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment