私は複数のシートで優れています。以下のマクロコードで1枚のシートにマクロを作成しました。このコードを編集してブック内のすべてのシートに一度に適用するにはどうすればよいですか。これはあなたのニーズに合わせて、あなたがすべてのシートに適用するマクロをExcel
サブスコアシート() ' ' マクロ '
'
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Columns("F:F").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("E:E").Select
Selection.TextToColumns Destination:=Range("E1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="-", FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
Columns("I:I").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("H:H").Select
Selection.TextToColumns Destination:=Range("H1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="-", FieldInfo:=Array(1, 1), TrailingMinusNumbers:=True
Range("I1").Select
ActiveCell.FormulaR1C1 = "3fga "
With ActiveCell.Characters(Start:=1, Length:=5).Font
.Name = "Verdana"
.FontStyle = "Bold"
.Size = 7.5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Columns("L:L").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("K:K").Select
Selection.TextToColumns Destination:=Range("K1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="-", FieldInfo:=Array(1, 1), TrailingMinusNumbers:=True
Columns("Y:AB").Select
Selection.Delete Shift:=xlToLeft
Columns("Z:Z").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("Y:Y").Select
Selection.TextToColumns Destination:=Range("Y1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="-", FieldInfo:=Array(1, 1), TrailingMinusNumbers:=True
Range("Y1").Select
ActiveCell.FormulaR1C1 = "op_fgm"
With ActiveCell.Characters(Start:=1, Length:=6).Font
.Name = "Verdana"
.FontStyle = "Bold"
.Size = 7.5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Range("Z1").Select
ActiveCell.FormulaR1C1 = "op_fga "
With ActiveCell.Characters(Start:=1, Length:=7).Font
.Name = "Verdana"
.FontStyle = "Bold"
.Size = 7.5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Columns("AA:AA").Select
Selection.Delete Shift:=xlToLeft
Columns("AB:AB").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("AA:AA").Select
Selection.TextToColumns Destination:=Range("AA1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="-", FieldInfo:=Array(1, 1), TrailingMinusNumbers:=True
Range("AA1").Select
ActiveCell.FormulaR1C1 = "op_3fg"
With ActiveCell.Characters(Start:=1, Length:=6).Font
.Name = "Verdana"
.FontStyle = "Bold"
.Size = 7.5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Range("AB1").Select
ActiveCell.FormulaR1C1 = "op_3fga "
With ActiveCell.Characters(Start:=1, Length:=8).Font
.Name = "Verdana"
.FontStyle = "Bold"
.Size = 7.5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Columns("AC:AC").Select
Selection.Delete Shift:=xlToLeft
Columns("AD:AD").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("AC:AC").Select
Selection.TextToColumns Destination:=Range("AC1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="-", FieldInfo:=Array(1, 1), TrailingMinusNumbers:=True
Range("AC1").Select
ActiveCell.FormulaR1C1 = "op_ftm"
With ActiveCell.Characters(Start:=1, Length:=6).Font
.Name = "Verdana"
.FontStyle = "Bold"
.Size = 7.5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Range("AD1").Select
ActiveCell.FormulaR1C1 = "op_fta "
With ActiveCell.Characters(Start:=1, Length:=7).Font
.Name = "Verdana"
.FontStyle = "Bold"
.Size = 7.5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Columns("AE:AE").Select
Selection.Delete Shift:=xlToLeft
Range("AE1").Select
ActiveCell.FormulaR1C1 = "op_off "
With ActiveCell.Characters(Start:=1, Length:=7).Font
.Name = "Verdana"
.FontStyle = "Bold"
.Size = 7.5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Range("AF1").Select
ActiveCell.FormulaR1C1 = "op_def "
With ActiveCell.Characters(Start:=1, Length:=7).Font
.Name = "Verdana"
.FontStyle = "Bold"
.Size = 7.5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Columns("AG:AH").Select
Selection.Delete Shift:=xlToLeft
Range("AG1").Select
ActiveCell.FormulaR1C1 = "op_pf "
With ActiveCell.Characters(Start:=1, Length:=6).Font
.Name = "Verdana"
.FontStyle = "Bold"
.Size = 7.5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Range("AH1").Select
ActiveCell.FormulaR1C1 = "op_ast "
With ActiveCell.Characters(Start:=1, Length:=7).Font
.Name = "Verdana"
.FontStyle = "Bold"
.Size = 7.5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Range("AI1").Select
ActiveCell.FormulaR1C1 = "op_to "
With ActiveCell.Characters(Start:=1, Length:=6).Font
.Name = "Verdana"
.FontStyle = "Bold"
.Size = 7.5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Range("AJ1").Select
ActiveCell.FormulaR1C1 = "op_blk "
With ActiveCell.Characters(Start:=1, Length:=7).Font
.Name = "Verdana"
.FontStyle = "Bold"
.Size = 7.5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Range("AK1").Select
ActiveCell.FormulaR1C1 = "op_stl "
With ActiveCell.Characters(Start:=1, Length:=7).Font
.Name = "Verdana"
.FontStyle = "Bold"
.Size = 7.5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Columns("AL:AM").Select
Selection.Delete Shift:=xlToLeft
Range("T1").Select
ActiveCell.FormulaR1C1 = "to "
With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = "Verdana"
.FontStyle = "Bold"
.Size = 7.5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Rows("1:1").Select
Range("P1").Activate
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
Range("X1").Select
End Subの
あなたはVBAでのワークシートをループをグーグルする必要があります。 –
あなたは私にそれを見せてもらえますか?私は開発者ではない。ありがとうございます –
うわー、そのレコーダーコードは冗長です... http://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba-macros – Rdster