跳到主要内容

在 Excel 中生成二维码(完整方法的简单指南)

添加一名作者 最后修改时间:2024-05-14

在当今的数字时代,二维码已成为快速有效地共享信息的重要工具。本指南探讨了直接在 Excel 中创建 QR 码的不同技术,无论您使用的是最新的 Excel 365 还是早期版本。读完本文后,您将具备将 QR 码无缝集成到 Excel 项目中的能力。


在 Excel 365 中生成二维码

Excel 365 通过以下功能增强了其功能 图像LAMBDA,允许用户动态生成二维码。本节将向您展示如何使用 Excel 365 中的 IMAGE 或 LAMBDA 函数生成 QR 码。


使用图像函数

在此示例中,我们将使用 IMAGE 函数生成包含以下网站链接的二维码。

  1. 选择您想要显示二维码的单元格。这里我选择 D3 显示包含链接的二维码 Extendoffice 网站。
  2. 输入以下公式并按 输入 获取二维码。
    =IMAGE("https://quickchart.io/qr?text=" & ENCODEURL(C3))
  3. 选择此公式单元格,双击单元格的右下角(绿色方块)以获取其余的二维码。
备注:
  • 请将公式中的 C3 以及包含要在 QR 码中编码的文本的单元格引用。
  • 如果引用单元格中的内容发生变化,二维码将自动更新。
  • 此公式还可用于在 Google Sheets 中生成 QR 码。
  • QuickChart.io 提供了一个简单的API来生成QR码。生成二维码的基本URL是 https://quickchart.io/qr?text=.

使用 LAMBDA 函数

对于许多 Excel 用户来说,记住复杂的公式可能具有挑战性。在本节中,我将演示如何使用 LAMBDA 函数 基于前面提到的创建自定义且可重用的函数 图像公式。这将使您将来可以使用更简单的用户定义函数在 Excel 中生成 QR 码。

步骤 1:使用 LAMBDA 函数定义名称
  1. 公式 选项卡并单击 定义名称 ,在 定义名称 组。
  2. 在弹出 编辑名称 对话框,您需要配置如下。
    1. 名字 框中,为 LAMBDA 公式命名。这里我将其命名为 fn获取二维码.
    2. 框中,输入以下公式。
      =LAMBDA(text, IMAGE("https://quickchart.io/qr?text=" & ENCODEURL(text) & "&size=150"))
    3. 点击 OK 保存定义的名称。看截图:
      :
      • 在公式, 150 是 QR 码图像的默认像素大小。您可以根据需要调整该值,但请记住,生成的二维码在 Excel 中的实际显示大小将由单元格的大小决定。
      • 要了解有关 LAMBDA 函数的更多信息,请访问此页面: Excel LAMBDA 函数 (365).
步骤2:应用自定义函数生成二维码
  1. 选择您想要显示二维码的单元格。这里我选择 D3 显示包含链接的二维码 Extendoffice 网站。
  2. 输入以下公式并按 输入 获取二维码。
    =fnGetQRCode(C3)
  3. 选择此公式单元格,双击单元格的右下角(绿色方块)以获取其余的二维码。
    :
    • 在公式:
      • fn获取二维码 是您在步骤 1 中定义的名称。
      • 请更换 C3 以及包含要在 QR 码中编码的文本的单元格引用。
    • 如果引用单元格中的内容发生变化,二维码将自动更新。

在所有 Excel 版本中生成 QR 码

对于无法访问 Excel 365 的用户,仍然有可靠的选项可以通过加载项和外部工具生成 QR 码,从而可以在所有版本的 Excel 中访问此功能。


使用Excel内置插件一一生成二维码

Excel 加载项如 QR4办公室 提供跨多个版本的 Excel 兼容的强大替代方案。此方法允许对 QR 码进行详细定制,非常适合需要在文档中偶尔生成代码的用户。

步骤 1:安装 QR4Office 插件
  1. 在MyCAD中点击 软件更新 插页 > 获取加载项.
    备注:如果看不到 获取加载项 命令下的 插页 功能区中的选项卡,您需要手动添加它。以下是将此命令添加到 快速访问工具栏:
    1. 点击 自定义快速访问工具栏 下拉箭头并选择 更多命令 从菜单。
    2. Word选项“ 窗口:
      1. 选择 功能区中没有的命令 来自 从中选择命令 下拉列表。
      2. 查找并选择 获取加载项 在左侧命令列表中。
      3. 点击 地址 按钮( 获取加载项 命令将添加到右窗格)。
      4. 点击 OK 保存更改。 看截图:
    3. 获取加载项 命令现已添加到 快速访问工具栏。您可以点击它来打开 Office 加载项 存储。
  2. Office 加载项 商店:
    1. 键入“QR4办公室“ 在搜索框中并按 输入.
    2. 一旦 QR4办公室 出现加载项,单击 地址 按钮进行安装。
  3. 在下面的提示框中,单击 继续.
步骤2:使用QR4Office插件生成二维码

安装完成后, QR4办公室 窗格将自动在您的工作簿右侧打开,允许您生成二维码,如下所示。

  1. 选择包含要在 QR 码中编码的文本或链接的单元格。
    在这种情况下,请附上指向 Extendoffice 网站,我选择单元格 C3 包含网址。
  2. 点击 复制当前文档选择 按钮将单元格内容传输到 QR4Office 字段。
    Tips::或者,您可以从下拉列表中选择 URL 或文本类型,然后在文本框中手动输入所需信息。
  3. 附加选项 部分,您可以选择通过选择颜色、背景和大小来自定义 QR 码的外观,或保留默认设置。
  4. 选择 QR 码的目标单元格。这里我选择 D3.
  5. 点击 插页 将 QR 码放入所选单元格中。看截图:
  6. 重复以上5步即可生成其他二维码。

使用Kutools for Excel批量生成QR码

还有一个插件, Kutools for Excel 与 QR4Office 相比,它具有在选定范围内批量生成 QR 码的能力,具有明显的优势。这 插入二维码 的特点 Kutools for Excel 对于需要高效创建多个二维码的用户来说尤其有价值。它可以跨多个单元实现流程自动化,从而节省时间并最大限度地减少手动输入错误。

安装 Kutools for Excel, 去选择 库工具 > 插页 > 插入二维码 打开 插入二维码 ,然后就可以批量生成二维码了,如下:

  1. 数据范围 字段中,选择包含要在 QR 码中编码的文本或链接的单元格范围。
  2. 插入范围 字段中,选择一个单元格范围来放置相应的二维码。
  3. 附加选项 部分,您可以选择通过指定大小、线条颜色等来自定义 QR 码的外观,或保留默认设置。
  4. 点击 产生 按钮同时为所有选定的单元格生成二维码。
备注:使用此功能之前,请确保已安装 Kutools for Excel。 立即下载具有 Kutools for Excel 全部功能的 30 天免费试用版!

无论您使用 Excel 365 的高级功能还是依赖适用于所有版本的加载项,在 Excel 中生成 QR 码都非常简单。通过遵循本指南中概述的步骤,您可以有效地将 QR 码集成到 Excel 工作表中,从而增强数据的交互性和可访问性。探索这些方法,找到最适合您需求的方法,并以新颖的创新方式简化您的工作流程。对于那些渴望深入研究 Excel 功能的人,我们的网站拥有丰富的教程。 在这里了解更多 Excel 提示和技巧.

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

课程描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (38)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Is it possible to make a payment qr code in excel?
f.e. In cell A1 I've an amout of 10 euro, and in cell B2 I want to have an qr code so anyone can pay me with the qr code?

Thanks.
This comment was minimized by the moderator on the site
Hi Ruben,

Thank you for reaching out with your question. While Kutools for Excel does feature QR code generation, creating a payment QR code directly in Excel for transactional purposes is beyond the scope of this feature. Payment QR codes usually require integration with financial services or payment platforms to ensure secure transactions. I recommend exploring services specifically designed for creating payment QR codes, such as those offered by banks or digital payment systems. These platforms can generate a QR code linked to your payment details securely. Once you have the payment QR code, you could then include it in your Excel document as an image.
This comment was minimized by the moderator on the site
Hello

The download link provided in step 4 appears to be only Microsoft Barcode Control 14.0. Can anyone suggest a correct link for 16.0 please?

Thank you.
This comment was minimized by the moderator on the site
1 Sheets waar in de cellen van de rij random QR codes binnen komen. Waarvan elke QR code automatisch de juiste Sheets openend?
Of de BVA commando codes van de Button om de koppeling maken naar een andere sheets.
Dan ben erg dankbaar voor.
(dit is voor vrijwilligerswerk)

Groetjes,
H. van Schaijk
This comment was minimized by the moderator on the site
Hi H. van Schaijk,
I can't fix this problem. Sorry about that.
This comment was minimized by the moderator on the site
Hi folks,
Below code works fine with me, which is linked to cell range & generates the QR at each row cell 5000 nos, however I would like to stop the QR object generation if the reference cell value is zero / otherway round should generate the QR at adjucent cell if the value at reference cell is more than zero or <>""

Please seek experts assistance!!

thank you in advance

Sub Gen_StockOut_QR()
MsgBox ("Will Generate QR Code for Stock_Out Items at In@Out Sheet")
Sheets("In@Out_Data").Select
ActiveSheet.Unprotect Password:=" "
'Column range set at QR_Code
Range("QR_Code").Select

For Each cell In Selection
'cell.Offset(0, 23).Select ' 1 indicates the position of excel column A1 from the formula/webaddress/site/characters to be used to generate QR code
cell.Offset(0, 0).Select

' My case QRCode is at column 24 hence 24 as column from A1, QR Size 100*100
FilePath = "http://chart.googleapis.com/chart?chs=100x100&&cht=qr&chl=" & WorksheetFunction.EncodeURL(cell.Value) ' here is the cell value

With ActiveSheet.Pictures.Insert(FilePath)
'.ShapeRange.ScaleWidth 0.95, msoFalse, msoScaleFromTopLeft
'.ShapeRange.ScaleHeight 0.95, msoFalse, msoScaleFromTopLeft

End With
Next cell
End Sub
This comment was minimized by the moderator on the site
Interesting article - thank you.  How do I remove the custom control from the list please?
This comment was minimized by the moderator on the site
Hi,Do you mean to remove the Form Control inserted in the VBA code method? If so, you just need to right click it (when there is a context menu listed, click anywhere outside it to hide the context menu), and then press Delete to remove it.
This comment was minimized by the moderator on the site
Olá! Para mim, nenhum dos comentários ou esse post funcionou corretamente, mas utilizando o Visual Basic com o código que deixarei abaixo funcionou, pois criou uma função para mim. E para usar a função é só abrir a planilha e digitar: "=QrCode("célula desejada")"




Function QrCode(codetext As String)
Dim URL As String, MyCell As Range
'Para gerar o código, precisa a máquina ter acesso a internet
Set MyCell = Application.Caller
URL = "https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=" & codetext
On Error Resume Next
ActiveSheet.Pictures("QR_" & MyCell.Address(False, False)).Delete
On Error GoTo 0
ActiveSheet.Pictures.Insert(URL).Select
With Selection.ShapeRange(1)
.PictureFormat.CropLeft = 15
.PictureFormat.CropRight = 15
.PictureFormat.CropTop = 15
.PictureFormat.CropBottom = 15
.Name = "QR_" & MyCell.Address(False, False)
.Left = MyCell.Left + 2
.Top = MyCell.Top + 2
End With
QrCode = ""
End Function
This comment was minimized by the moderator on the site
Wie lösche ich die QR Code Grafik wieder ? wenn ich mit den Skript Wie erstelle ich einen QR-Code basierend auf dem Zellenwert in Excel? einen QR Code erzeugt habe ?
This comment was minimized by the moderator on the site
Hi All,

I modified the VBA code for creation a multi QR codes from selection in excel column

Follow until step 10 then add this code

Sub setQR()

Dim xSRg As Range
Dim xRRg As Range
Dim xObjOLE As OLEObject
On Error Resume Next
Dim srcSelection As Range
Dim srcCell As String
For Each srcSelection In Application.Selection
Dim qrCelltoupdate As String
Dim qrTxt As String
qrCelltoupdate = srcSelection.Offset(0, 1).Address
qrTxt = srcSelection.Text
Worksheets("Sheet1").Range(qrCelltoupdate).Select
Application.ScreenUpdating = False
Set xObjOLE = ActiveSheet.OLEObjects.Add("BARCODE.BarCodeCtrl.1")
xObjOLE.Object.Style = 11
xObjOLE.Object.Value = qrTxt
ActiveSheet.Shapes.Item(xObjOLE.Name).Copy
ActiveSheet.Paste
xObjOLE.Delete
Next srcSelection
'Create Qr code from selection multi cells
End Sub


In step 12
Assign Macro
Chose: Sheet1.setQR

QR codes will be populated in next column

Hope that helps for you all
This comment was minimized by the moderator on the site
Hi ChavdarHarchev.
First of all thank You very much for Your nice work.

Is it possible for You to show how the VBA code looks like when it is finished?
Best regards
Pierre Galuszka.
This comment was minimized by the moderator on the site
Hi All,
I modified the VBA code for creation a multi QR codes from selection in excel column
Follow until step 10 then add this code
Sub setQR()

Dim xSRg As Range
Dim xRRg As Range
Dim xObjOLE As OLEObject
On Error Resume Next
Dim srcSelection As Range
Dim srcCell As String
For Each srcSelection In Application.Selection
Dim qrCelltoupdate As String
Dim qrTxt As String
qrCelltoupdate = srcSelection.Offset(0, 1).Address
qrTxt = srcSelection.Text
Worksheets("Sheet1").Range(qrCelltoupdate).Select
Application.ScreenUpdating = False
Set xObjOLE = ActiveSheet.OLEObjects.Add("BARCODE.BarCodeCtrl.1")
xObjOLE.Object.Style = 11
xObjOLE.Object.Value = qrTxt
ActiveSheet.Shapes.Item(xObjOLE.Name).Copy
ActiveSheet.Paste
xObjOLE.Delete
Next srcSelection
'Create Qr code from selection multi cells
End Sub


In step 12 Assign Macro Chose: Sheet1.setQR
QR codes will be populated in next column
Hope that helps for you all
This comment was minimized by the moderator on the site
I didn't have "Microsoft Barcode Control 16.0" so I down loaded per instruction. And open Excel with Admin mode. Then try to "Register Custom" . But I opened Barcode control folder and select MSBCODE964,OCX. Then there is error message came out. It said "The selected file does not contain self-registrating ActiveX control". What it means? What is the problem. And how can I install that?
This comment was minimized by the moderator on the site
1)Click File > Options.

2)Click Trust Center > Trust Center Settings > ActiveX Settings.

Click the options below, and then click OK.
* Enable all controls without restrictions and without prompting (not recommended)
3)Click Ok
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations