Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@sharapeco
Created September 5, 2018 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sharapeco/5d8efc8c66ab998ef4ce38b350cc40ae to your computer and use it in GitHub Desktop.
Save sharapeco/5d8efc8c66ab998ef4ce38b350cc40ae to your computer and use it in GitHub Desktop.
Excel で全角-半角変換
Sub Zen2han()
Dim num As Integer
Dim cells As Range
Set cells = ActiveSheet.cells.SpecialCells(xlCellTypeConstants, xlTextValues)
For num = 0 To 9
cells.Replace What:=Right(StrConv(Str(num), vbWide), 1), Replacement:=Right(Str(num), 1)
Next
cells.Replace What:="-", Replacement:="-"
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment