以下、記録。選択中のシート内に横罫を1本引くだけ。

Sub Macro1()
Range("B5").Select

Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
End Sub



このままだと無駄な処理が多いので、削除する。

Sub Macro1()
Range("B5").Select
'--- Selection.Borders(xlDiagonalDown).LineStyle = xlNone
'--- Selection.Borders(xlDiagonalUp).LineStyle = xlNone
'--- Selection.Borders(xlEdgeLeft).LineStyle = xlNone
'--- Selection.Borders(xlEdgeTop).LineStyle = xlNone
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With

'-- Selection.Borders(xlEdgeRight).LineStyle = xlNone
End Sub


いらないので削り、更にシンプルに。

Sub Macro1()

Range("B5").Borders(xlEdgeBottom).Weight = xlThin
End Sub


A1をR1C1にすると

Sub Macro1()
Cells(5, 2).Borders(xlEdgeBottom).Weight = xlThin

End Sub

Range("B5")は1つのセルを選択している。よって、等価の Cells(5,2) に置き換えられる。
B2のセルは、B列、つまり2列目/5行目である。Cellsで表す際は、()内に、行、列の順に記載する。


前回のプログラムと組み合わせて


Sub Macro1()

With Range(Cells(3, 2), Cells(16, 2))
.Borders(xlEdgeLeft).Weight = xlThin
.Borders(xlEdgeRight).Weight = xlThin
End With
Cells(5, 2).Borders(xlEdgeBottom).Weight = xlThin
End Sub

横罫を適当に数行足すと


Sub Macro1()
With Range(Cells(3, 2), Cells(16, 2))
.Borders(xlEdgeLeft).Weight = xlThin
.Borders(xlEdgeRight).Weight = xlThin
End With
Cells(5, 2).Borders(xlEdgeBottom).Weight = xlThin
Cells(8, 2).Borders(xlEdgeBottom).Weight = xlThin
Cells(10, 2).Borders(xlEdgeBottom).Weight = xlThin
Cells(12, 2).Borders(xlEdgeBottom).Weight = xlThin
End Sub

縦横の罫はこれで記述できる。



今のプロジェクト、とりあえず1次フェーズが終了するが、顧客の資金繰りの関係で9月末でいったん解散する方向になりそうである。

いつ2次フェーズがいつ再開するかは分からないが、再開した時点では即携われる方が望ましいし、あわよくば1次の保守もしてあげたい。

よって、10月以降、しばらくスポット的な仕事でつないでみようかと目論んでみた。
業務の相談をしてみませんか?場合によっては受注も可です。」。依頼は9/12(金)をリミットとさせて頂く。

《問い合わせの回答になるよう、整理して書き換えます》

【念のため ~ 当たり前ですが】
・受注に結びつけることだけが目的ではありませんので、外部の人と契約する権限がない方(正社員/外注/派遣などは問いません)でも、お気軽にご相談下さい。
相談は無料です。正式な依頼がない限り、こちらから契約を迫ることはありません。
・秘密は厳守します。

【参考まで】
・ソースを読みやすいように書き直したいが、アドバイスは?くらいで、規模が小さい/回数が少ない、ならば無料でいいです。
 ⇒ブログのネタにさせていただけると有り難いですが、NGならネタにしません。

【契約するとしたら】
・契約形態: 個人/現在の契約先経由 請負/委託 いずれも可です。
・就業形態: 持ち帰り/週1~4・5日の通い/月に1回~4回程度/1回限り/メールで「とにかくこれを!」 など 柔軟に対応します。
・立ち位置: アドバイサー/システムコンサル くらいが有り難いです。マネージャー/リーダー/メンバー/保守要員 などもできますが、可能なら複数箇所でお手伝いができれば、という希望があります。
・金額: 当初の相談は無料です。その中で規模や難易度によって、期間や金額を相談していければと存じます。なお、遠方の場合、必要に応じて交通費/宿泊費をお願いする場合あります。

問い合わせは tech-note*mail.goo.ne.jp まで。(*を@に修正してください。)

《参考》 過去の構築事例


特に希望がなければ、通常の常駐案件に潜り込む所存である。

罫線を引く、という行為をVBAで行うことになる。
そういう時に役立つのが、[ツール]-[マクロ]-[新しいマクロの記録]である。分からないときは記録するといい。それだけでVBAのコードが生成されるのだ。

以下、記録してみた。選択中のシートに縦罫を2本引くだけ。

Sub Macro1()
'
Range("B3:B16").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With

Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With

Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
End Sub

このままだと無駄な処理が多いので、削除する。記録したVBAには無駄が多いのだ。短くしよう。

Sub Macro1()
Range("B3:B16").Select
'--- Selection.Borders(xlDiagonalDown).LineStyle = xlNone
'--- Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
'--- .LineStyle = xlContinuous
.Weight = xlThin
'--- .ColorIndex = xlAutomatic
End With

'--- Selection.Borders(xlEdgeTop).LineStyle = xlNone

'--- Selection.Borders(xlEdgeBottom).LineStyle = xlNone
With Selection.Borders(xlEdgeRight)
'--- .LineStyle = xlContinuous
.Weight = xlThin
'--- .ColorIndex = xlAutomatic
End With
'--- Selection.Borders(xlInsideHorizontal).LineStyle = xlNone

End Sub

線を引かない部分はカットするだけでこうである。更にまとめる


Sub Macro1()
With Range("B3:B16")
.Borders(xlEdgeLeft).Weight = xlThin
.Borders(xlEdgeRight).Weight = xlThin
End With
End Sub

ここのポイントは With の使い方である。あと、VBAとして注意して欲しい点を変更する。

Sub Macro1()
'xxx With Range("B3:B16")
With Range(Cells(3, 2), Cells(16, 2))
.Borders(xlEdgeLeft).Weight = xlThin
.Borders(xlEdgeRight).Weight = xlThin
End With
End Sub

VBAで行や列を順次チェックするなら、数字で座標を表すR1C1形式の方が使いやすい。記録したA1形式ではプログラムとして利用しにくい。
R1C1とA1を混ぜても使えるが、R1C1に統一した方がややこしくなくていい。