Skip to content

Instantly share code, notes, and snippets.

@hemge
Created August 27, 2014 09:35
Show Gist options
  • Select an option

  • Save hemge/5b94d82a149312617116 to your computer and use it in GitHub Desktop.

Select an option

Save hemge/5b94d82a149312617116 to your computer and use it in GitHub Desktop.
行頭のスペースを削除するExcelマクロ
Sub ltrim_excel()
Dim objRE
Dim strText
Dim strRes
Dim r
Set objRE = CreateObject("VBScript.RegExp")
objRE.Pattern = "^ "
For Each r In ActiveSheet.UsedRange
If objRE.Test(r.Value) Then r.Value = LTrim(r.Value)
Next r
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment