0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

A列にある文字列をB列に置換する低需要エクセルマクロ

Posted at

置換するマクロ

『置換項目』シートのA列にある文字列をB列に置換するだけのマクロ。
置換したいものは『対象』に記載する。
※特にテキストベースで書き出したりはしない。

Replace.word
Sub test()

Application.DisplayAlerts = False

Dim num As Variant

  num = WorksheetFunction.CountA(Range("A1:A100"))

For i = 1 To num

Sheets("置換項目").Activate
befor = Cells(i, 1)
after = Cells(i, 2)

Sheets("対象").Activate
Cells.Replace What:=befor, Replacement:=after

Next i

Application.DisplayAlerts = True


End Sub

上記をVBAに突っ込んでマクロ有効ブックにするればうまくいくはず。
そんなものなくてもよくね?とか言わないで。
テキストベースの手順書を作成する会社だと用意しておくと何かと便利。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?