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

BORUCH

Well-known Member
Joined
Mar 1, 2016
Messages
528
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

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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,214,920
Messages
6,122,269
Members
449,075
Latest member
staticfluids

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