1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

クリップボードにコピーするだけのVBA

Posted at

Excelで改行あるセルをコピーすると" "がついて嫌なので、VBA書いてボタン化することに。
意外に「コピーだけ」のスクリプトはなかったので、備忘録的に残す。(ほぼ他サイトの切り抜き)

※使用前に、Visual Basic→[ツール/参照設定]→[参照]→ファイル名「FM20.DLL」を開く。これがないとDataObjectが使えない。

Sub クリップボードにコピー()
    Dim buf As String, CB As New DataObject
    buf = Range("A1")       '任意のセル
    With CB
        .SetText buf        '変数のデータをDataObjectに格納
        .PutInClipboard     'DataObjectのデータをクリップボードに格納
    End With
End Sub
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?