excel vba to add a symbol at the beginning of a cell

BORUCH

Well-known Member
Joined
Mar 1, 2016
Messages
548
Office Version
  1. 365
Platform
  1. Windows
hi all

i have my excel table like below

Book1
AB
1ITEM NUMBER DESCRIPTION
212345APPLES
3000001ORANGES
401000PEARS
Sheet1


what i would like is an excel vba that pops a input box where i would enter the item number and it would put a * at the beginning of the description i would like to have the input box pop up multiple times for different item numbers till i type in the letters "END" that means I'm finished
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hi @BORUCH . Thanks for posting on the forum.

Try this:

VBA Code:
Sub ItemNumber()
  Dim n As Variant
  Dim f As Range
  
  Do While True
    n = InputBox("Enter Item Number")
    If LCase(n) = LCase("END") Or n = False Or n = "" Then Exit Do
    Set f = Range("A:A").Find(n, , xlValues, xlWhole, , , False)
    If Not f Is Nothing Then
      f.Offset(, 1).Value = "*" & f.Offset(, 1).Value
    End If
  Loop
End Sub

--------------
Let me know the result and I'll get back to you as soon as I can.
Cordially
Dante Amor
--------------​
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,201
Members
453,022
Latest member
RobertV1609

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