Skip to main content

How to create qr code based on cell value in Excel?

Do you know how to create QR code based on specific cell value in Excel? This article will show you a method to achieve it in details.

Create QR code based on cell value with Barcode Control and VBA code
Easily create multiple QR codes in bulk based on cell values with an amazing tool


Create QR code based on cell value with Barcode Control and VBA code

The Barcode Control can help you quickly create QR code based on cell value in Excel. Please do as follows.

1. Open the worksheet contains the cell value you will create QR Code based on.

2. Click Developer > Insert > More Control. See screenshot:

3. In the More Controls window, check for the Microsoft Barcode Control 16.0 or Microsoft Barcode Control 15.0.

4. If you didn’t find the Barcode Control in the More Controls window or the Barcode Control does not the 16.0 or 15.0, you need to download the barcode control file by clicking this links: download barcode control. If there is Barcode Control 16.0 or 15.0 in your More Controls window, just jump to below step 10.

After downloading the file, unzip it and then update the Barcode Control with the downloaded barcode control in your Excel as follows.

5. Close all your Excel workbooks, go to the Start section, find the Excel app and right click on it, then select Run as administrator from the context menu. See screenshot:

6. In the opening User Account Control dialog box, click the Yes button.

7. Then a new workbook is created. Please click Developer > Insert > More Control. See screenshot:

8. In the More Controls window, click Register Custom button, find and select one of the downloaded qr code OCX file and then click the Open button. See screenshot:

9. Click the OK button when it returns the More Controls window to finish the Barcode Control updated. Then reopen the workbook contains the cell values you will create QR Codes based on.

10. Right click the sheet tab and click View Code from the context menu to open the Microsoft Visual Basic for Applications window. Then copy and paste below VAB code into the Code window. And finally press the Alt + Q keys to exit the Microsoft Visual Basic for Applications window.

VBA code: Create QR code in Excel

Sub setQR()
'Updated by Extendoffice 2018/8/22
    Dim xSRg As Range
    Dim xRRg As Range
    Dim xObjOLE As OLEObject
    On Error Resume Next
    Set xSRg = Application.InputBox("Please select the cell you will create QR code based on", "Kutools for Excel", , , , , , 8)
    If xSRg Is Nothing Then Exit Sub
    Set xRRg = Application.InputBox("Select a cell to place the QR code", "Kutools for Excel", , , , , , 8)
    If xRRg Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    Set xObjOLE = ActiveSheet.OLEObjects.Add("BARCODE.BarCodeCtrl.1")
    xObjOLE.Object.Style = 11
    xObjOLE.Object.Value = xSRg.Text
    ActiveSheet.Shapes.Item(xObjOLE.Name).Copy
    ActiveSheet.Paste xRRg
    xObjOLE.Delete
    Application.ScreenUpdating = True
End Sub

11. Click Developer > Insert > Button (Form Control) as below screenshot shown.

12. Draw a button into current worksheet. In the popping up Assign Macro dialog, select setQR in the box and then click the OK button.

13. Turn off the Design Mode by clicking Developer > Design Mode.

14. Click the button, in the opening Kutools for Excel dialog, select the cell you will create QR Code based on and click OK.

15. In the second Kutools for Excel dialog, select a cell to place the QR Code. See screenshot:

Then the QR Code will be inserted into specified cell immediately. Repeat step 14 to 15 to finish all QR Code created. See screenshot:


Easily create multiple QR codes in bulk based on cell values with an amazing tool

To be honest, the above method is not easy to handle as it has its own limitation. Here highly recommended the Insert QR Code feature of Kutools for Excel. This feature can help you quickly insert QR codes in bulk based on specified cell values in Excel with several clicks only. Please do as follows to get it done.

Before applying Kutools for Excel, please download and install it firstly.

1. Firstly, prepare your values that you want to create QR code based on.

2. Click Kutools > Insert > Insert QR Code.

Tips: If you can’t find the feature with this path, please press the Alt + S keys simultaneously to open the Search Kutools Functions box, manually type QR Code in the search box, then you can see the Insert QR Code feature is listed out, just click to activate the feature. See screenshot:

Now the Insert QR Code pane is displayed on the right side of the workbook.

3. In the Insert QR Code pane, you need to configure as follows.

3.1) In the Data Range box, select the range of cells containing the values you want to create QR Code based on;
3.2) In the Insert Range box, select a range of blank cells to output the QR code;
3.3) In the Options section, configure the size, line color, background color and Error Correction level for the QR code as you need;
Note: The size of the QR code cannot exceed 500 pixels.
3.4) Click the Generate button. See screenshot:

4. Then a Kutools for Excel dialog box pops up, click OK.

5. Then the QR codes are created at the same time. You need to manually close the Insert QR Code pane if finish creating all QR codes.

Click to know more about this feature...


Related article:

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
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