QR codes are encrypted squares that can include content, links, event information, and other information that users wish to see. You can generate QR code with the help of Excel. The main objective of this article is to demonstrate how to create QR code in Excel.
In this article, I will explain 3 methods by which you can create QR code in Excel. To explain these methods I have taken a dataset that contains the Site Name and its URL which is the Value for our QR code.
1. Using Office Add-ins to Create QR Code in Excel
In this method, I will explain how to create QR Code in Excel by using Office Add-ins.
Let’s see step by step how it is done.
Steps:
- To begin with, go to the Insert tab.
- After that, select the Get Add-ins option from the Add-ins group.
A library will appear on the screen.
- Now, search for QR4Office. And you will get the QR4Office.
- Next, click on Add to add the QR4office to your Add-ins.
Now, it will show you license terms and policy.
- Finally, select Continue, and QR4Office will be installed.
- Now, again go to the Insert tab.
- After that, select My Add-ins.
This will lead you to your My Add-ins library.
- Next, select QR4Office.
- Finally, click on Add.
Now, you will see that QR4Office has opened on the Excel worksheet. You can type text or URL that you want to encode. You can also change the color, size, and background of the QR code from here.
- Now, type in the text or URL that you want to encode. Here, I typed the URL for ExcelDemy.
- Finally, click Insert to get your QR code.
Now, I have got the QR code for my desired site.
By following this same process you can get all the other QR codes you want.
Read More: Batch QR Code Generator from Excel
2. Creating User Defined Function to Generate a QR Code
In this 2nd method, I will explain how to create QR codes in Excel by using user defined function. For this, I will use VBA.
Let’s see step by step how it is done.
Steps:
- Firstly, go to the Developer tab.
- Secondly, select Visual Basic.
Now, you will see the Visual Basic window has opened.
- After that, go to the Insert tab.
- Now, select the Module option.
You will see a Module has opened. In that Module type in the following code.
Function QR_Generator(qrcodes_values As String)
Dim Site_URL As String
Dim Cell_Values As Range
Set Cell_Values = Application.Caller
Site_URL = "https://chart.googleapis.com/chart?chs=100x100&&cht=qr&chl=" & qrcodes_values
On Error Resume Next
ActiveSheet.Pictures("Generated_QR_CODES_" & Cell_Values.Address(False, False)).Delete
On Error GoTo 0
ActiveSheet.Pictures.Insert(Site_URL).Select
With Selection.ShapeRange(1)
.Name = "Generated_QR_CODES_" & Cell_Values.Address(False, False)
.Left = Cell_Values.Left + 2
.Top = Cell_Values.Top + 2
End With
QR_Generator = ""
End Function
Code Breakdown
- Here, I have created a Function named QR_Generator. Next, used qrcodes_values as String within the function.
- Then, declared Site_URL as String and Cell_Values as Range.
- Next, used the Application.Caller in the Set property to trigger the macro where it will be called.
- After that, given the URL address for qr codes.
- I, also used On Error Resume Next to ignore the error.
- Afterward, used the ActiveSheet.Pictures to create the picture in the active sheet.
- Next, by using the With statement re-sized the qr codes.
Now, Save the code as Excel Macro-Enabled Workbook and go back to your sheet.
- Now, select all the cells where you want your QR codes. Here, I selected cells D5, D6, and D7.
- After that, write the following formula.
=QR_Generator(C5)
Here, I used the QR_Generator function which I defined by the VBA code. And for qrcodes_values I selected cell C5. This function will return us the QR code for the Value in cell C5.
- Finally, press CTRL+ENTER and you will get QR codes for all the cells.
Read More: Excel VBA: Open Source QR Code Generator
3. Creating QR Codes in Excel Using the IMAGE Function
With the help of the IMAGE function, we can set a QR code quite easily, according to the size of the cell.
Steps:
- Just apply the following formula and use Fill Handle to AutoFill QR codes in the rest of the cells in column D.
=IMAGE("https://api.qrserver.com/v1/create-qr-code/?size=100×100&data="&C5)
Practice Section
Here, I have provided a practice sheet for you to practice.
Things to Remember
- While working with the second method it should be noted that here I used an open source link. So, to work this function properly you have to keep your internet connection on.
- While using the IMAGE function to generate QR codes, the generated QR codes get fitted according to the cell height. You can resize the QR codes just by changing the row height according to your need.
Frequently Asked Questions
1. Can I use a specific font to generate a dynamic QR code in Excel?
There is a dedicated font named AlphanumericQR to generate QR codes in Excel.
2. How do I generate a QR code with a formula in Excel?
With the help of the IMAGE function in a formula, we can generate a QR code in Excel.
3. Is it possible to create multiple QR codes at once in Excel?
With the help of a VBA code, we can create multiple QR codes quite easily.
QR Code in Excel: Knowledge Hub
- Create QR Code in Excel
- Scan QR Code to Excel Spreadsheet
- QR Code Attendance Tracking
- Batch QR Code Generator from Excel
- Excel VBA: Open Source QR Code Generator
Download Practice Workbook
You can download the practice workbook that is used in this article from the download link below.
Conclusion
To conclude, in this article I have tried to explain how to create QR codes in Excel. I covered 3 methods. Hope this was helpful for you. To get more articles like this visit ExcelDemy. If you have any questions please, let me know in the comment section below.
I’ve been trying to implement this code, and though it does work well on a workbook with only one sheet, it has problems on anything else. The QR code always ends up on the active sheet (right location but wrong sheet most of the time). I thought I could fix that by specifying the sheet where it belonged, for example replacing ActiveSheet with Worksheets(“Sheet 1”) in both instances in the code. It doesn’t seem to help. Is there a way to make the QR code show on the correct page?
Hey MARK,
Thanks for your comment. I am replying to you on behalf of ExcelDemy. For the provided practice workbook, I used the following VBA code and it solved this problem for me.
Function QR_Generator(qrcodes_values As String)
Dim Site_URL As String
Dim Cell_Values As Range
Set Cell_Values = Application.Caller
Site_URL = "https://chart.googleapis.com/chart?chs=100x100&&cht=qr&chl=" & qrcodes_values
On Error Resume Next
Worksheets("Using User Defined Function").Pictures("Generated_QR_CODES_" & Cell_Values.Address(False, False)).Delete
On Error GoTo 0
Worksheets("Using User Defined Function").Pictures.Insert(Site_URL).Select
With Selection.ShapeRange(1)
.Name = "Generated_QR_CODES_" & Cell_Values.Address(False, False)
.Left = Cell_Values.Left + 2
.Top = Cell_Values.Top + 2
End With
QR_Generator = ""
End Function
Now, Save the code and go back to your worksheet. Let’s see the steps of using the function.


Step-01: Select the cells where you want the QR Codes. Here, I selected cell range D5:D7 >> write the following formula.
=QR_Generator(C5)
Step-02: Press Ctrl + Enter and you will get your desired output.
I hope this will help you to solve your problem. Please let me know if you have other queries.
Regards
Mashhura,
ExcelDemy.