[[20110401203632]] 『Range("A1:D1").Select のようなマクロ文』(かんぞう) ページの最後に飛ぶ

[ 初めての方へ | 一覧(最新更新順) | 全文検索 | 過去ログ ]

 

『Range("A1:D1").Select のようなマクロ文』(かんぞう)

[Range("A1:D1").Select のようなマクロ文のセル値をワークシートのデータで操作できないでしょうか

 
  Range("A1:D1").Select

    Application.CutCopyMode = False
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    Selection.Borders(xlInsideVertical).LineStyle = xlNone
    With Selection.Interior
        .ColorIndex = 44
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
    End With
End Sub

 セル A1 から D1 までをセレクトし そのセルに色をつけて外枠線を
 入れるマクロを マクロの記録で作りました。

  A3 セルに 数字 を入れて その数だけ セレクトする Renge が変わるように
  したいのですが 何かいい方法はありませんでしょうか

  たとえば A3 セルに 2 を入れると
  Range("A1:D1").Select が Range("A1:B1").Select になるようにしたいのです  が・・・](かんぞう)


 Range("A1").Resize(1, Range("A3").Value).Select
で良いと思うけどなるべくSelect/Selectionは使用しないほうが良いですよ。
(BreakTime)

コメント返信:

[ 一覧(最新更新順) ]


YukiWiki 1.6.7 Copyright (C) 2000,2001 by Hiroshi Yuki. Modified by kazu.