lisblancのプロフィール

@lisblanc lisblanc
ありがとう数6
質問数6
回答数1
ベストアンサー数
0
ベストアンサー率
0%
お礼率
42%

  • 登録日2008/10/20
  • 任意のセルでマクロを実行させたい

    アクティブセルにマクロを実行させたいのですがうまくいきません。 2007のエクセルを使用しています。 (1)命令文で指定しているセル(G9:G11)をJ9:J11やR14:R16等でも使用したい。 (2)また作成したマクロを同シート内オートシェイプに登録したい。 よろしくお願いいたします。 Sub Macro2() ' ' Macro2 Macro ' ' Range("G9:G11").Select Selection.ClearContents With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlTop .Orientation = xlVertical .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = True End With With Selection.Font .Name = "MS P明朝" .FontStyle = "標準" .Size = 11 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .TintAndShade = 0 .ThemeFont = xlThemeFontNone End With With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .Color = 16777164 .TintAndShade = 0 .PatternTintAndShade = 0 End With ActiveCell.FormulaR1C1 = "搬入" With ActiveCell.Characters(Start:=1, Length:=2).Font .Name = "MS P明朝" .FontStyle = "標準" .Size = 11 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .TintAndShade = 0 .ThemeFont = xlThemeFontNone End With ActiveCell.Characters(1, 2).PhoneticCharacters = "ハンニュウ" Range("G12").Select End Sub