▽1
●
a-kuma3 ●100ポイント ベストアンサー |
こんな感じで。
Const INSERT_HEAD = 0 Const APPEND_TAIL = 1 Sub append_word_sub(target_col, insert_word, mode) last_row = Range(target_col & Rows.Count).End(xlUp).Row For r = 2 To last_row Set cell = Range(target_col & r) If Not IsEmpty(cell) And Not cell.Value = "" Then If mode = INSERT_HEAD Then cell.Value = insert_word & cell.Value Else cell.Value = cell.Value & insert_word End If Else Exit For End If DoEvents Next End Sub Sub append_word() Call append_word_sub("A", "【格安】", INSERT_HEAD) End Sub
サブルーチン append_word を呼び出してください。
表示されているシートで、A列の 2行目から空白のセルが出てくる行まで "【格安】" の文字を頭に挿入します。
サブルーチン append_word は、サブルーチン append_word_sub を呼び出しているだけです。
append_word_sub は、三つのパラメータを取ります。