Macro to find value, select cell and print selected cell

DB38

New Member
Joined
Mar 22, 2023
Messages
7
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Good morning
I'm looking for somebody who can help me with below.

In row (1:1) i have cells containing a image and a barcode nr 87.....
The idea is that i have a scanner that scan a 87.... barcode in an window.
The marco should look up this value in row (1:1) if the unique cell is found (and selected) i.e D1 then the active selected cell should be printed.


Hope anyone can help me with this.
Thanks in advance.

Din
 

Attachments

  • 2023-03-22_08h20_17.jpg
    2023-03-22_08h20_17.jpg
    124.3 KB · Views: 8
You are welcome :)

For your tests on Monday
VBA Code:
Sub PrintLabel()
Dim st As String, rng As Range
Dim answer As Integer
  ' Ask for Barcode to be serached in Row 1
  ' 12 Character Input such as : 871976947833
Line1:
  st = InputBox("Please scan a barcode and hit enter if you need to")
  ' Find the Address in Row 1
  Set rng = Rows("1:1").Find(st)
  ' Print Found Range
  rng.PrintOut
  ' Ask User if he wants to continue or not
  answer = MsgBox("Do you want to continue ?", vbQuestion + vbYesNo + vbDefaultButton2, "Scanning Process")
    If answer = vbYes Then
       ' Go back to the initial InputBox
        GoTo Line1:
    Else
        ' Leave the macro
        Exit Sub
    End If
End Sub
 
Upvote 0
Solution

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
perfect !!! Thanks again for your help and have a nice weekend
 
Upvote 0
Good News ...!!! :)

Pleased to hear you fixed your problem (y)
 
Upvote 0

Forum statistics

Threads
1,214,998
Messages
6,122,639
Members
449,093
Latest member
Ahmad123098

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top