LoginSignup
10
13

More than 3 years have passed since last update.

Excelに入力したURLをQRコードに変換してセルに貼り付け

Last updated at Posted at 2017-02-01

概要

一気にQRコードを作りたかったので、Excelに入力されたURLをQRコードにしてみました。
ポイントはGoogle Chart Apiです。

2019-05-27 追記

こんなツールを発見。こちらの方が良さげ。
【QRコードビルダー】
http://qr.ag-media.jp/

実際の例

excel_qr.gif

手順詳細

  1. 新規ワークシートを作る
  2. A列にQRコードにしたいURLを入力
  3. 「Alt + F11」を押す
  4. 「Alt + i」のあと「Alt + m」を押す
  5. 下のコードを張り付け
  6. 「Alt + F8」をおしてInsertQrcodeを選んで実行
Sub InsertQrcode()
    Dim i As Long, v As String
    On Error Resume Next
        For i = 1 To 9999
            v = Cells(i, "A").Value
            If v = "" Then Exit Sub 'カラになったら抜ける
            If Left(v, 4) = "http" Then 'httpで始まるurlが対象
                With Cells(i, "A")
                    .RowHeight = 100
                    .VerticalAlignment = xlTop
                End With
                Set obj = ActiveSheet.Pictures.Insert("http://chart.apis.google.com/chart?cht=qr&chs=80x80&chl=" + v)
                With obj
                    .ScaleHeight 1, msoTrue
                    .ScaleWidth 1, msoTrue
                    .Top = Cells(i, "A").Top + 16
                    .Left = Cells(i, "A").Left + 2
                End With
            End If
        Next i
    On Error GoTo 0
End Sub

※ QRコードを全部削除したいときは、F5をおして「セル選択」、「オブジェクト」を選んでOKを押す、「DEL」で削除。

10
13
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
10
13