こんにちは、私は可能な限りここでいくつかの助けが必要です。私は3つのボタンを作ろうとしていますが、各ボタンはトップラインとボトムラインを描きます(私はエクセルファイルも提供します)。ボーダーを描画するvbaがスペースのあるボタンで優秀
最初のボタンは5行の中で上と下を描画します。
2番目のボタンは、10行の内側に上端と下端を描画します。
3番目のボタンは、20行の中に上端と下端を描画します。
私が達成しようとしているもの: ボタン1を押して、すでに境界線が描画されている場合は1を押します。境界線を描画する場合は、そして、私はButton1を押したかどうボタン2.またはボタン3.
次に、同じ....の間に2行のスペースを保持した後、再び描く..私は、私はいくつかの助けを大好きだVBAで新しいです。 ...
ub Macro2()
'
' Macro2 Macro
'
'
Range("A13:BD23").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThick
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThick
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("A27").Select
ActiveWindow.SmallScroll Down:=12
Range("A27").Select
End Sub
Sub Macro1()
'
' Macro1 Macro
'
'
Range("A4:J8").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThick
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThick
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("C9").Select
End Sub
Sub Macro3()
'
' Macro3 Macro
'
'
Range("A26:P46").Select
ActiveWindow.SmallScroll Down:=-6
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThick
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThick
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("G34").Select
ActiveWindow.SmallScroll Down:=-15
End Sub
DLのLINK: https://mega.nz/#!sgkVATKQ!k-Nq5gpKf4NfW2afEM8wpg_T5RFqT6y2_iqH7lDTM40
どのボタンが最初に押されても、ハードコードされた範囲を開始点として使用し、その後に「前回」の範囲から2行のオフセットを使用する必要がありますか?しかし、さまざまな幅を保つ? –
これで私のファイルを作ろうとしているのですが...行間にスペースを追加する方法はわかりませんが、前のボーダーをカウントする方法はわかりません。 – maxxi