Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Input text
Can anyone help me please, i'm having difficulty solving this... I want to create a macro that will allow the user to input text o their choosing into a cell that already contains numbers, ie I have a column full of product codes and i want to be able t select the cells and run a macro which will bring up a box that wil allow the user to enter the text of their choosing and when they clic ok will insert their text before the current numbers in each of th selected cells. Any help would be much appreciate ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Input text
Try something like the following:
Sub AAA() Dim S As String Dim Rng As Range S = InputBox("Enter a value.") If StrPtr(S) = 0 Then ' user hit cancel Exit Sub Else For Each Rng In Selection.Cells Rng.Value = S & Rng.Text Next Rng End If End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "ali" wrote in message ... Can anyone help me please, i'm having difficulty solving this... I want to create a macro that will allow the user to input text of their choosing into a cell that already contains numbers, ie I have a column full of product codes and i want to be able to select the cells and run a macro which will bring up a box that will allow the user to enter the text of their choosing and when they click ok will insert their text before the current numbers in each of the selected cells. Any help would be much appreciated ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Input text
if I have understood your question correctly, you want
something like the following: dim c as Range, newText as String newText = InputBox("Please enter text", .........) For Each c in Selection.Cells c.value = newText & c.value next c Regards, Andy Keen -----Original Message----- Can anyone help me please, i'm having difficulty solving this... I want to create a macro that will allow the user to input text of their choosing into a cell that already contains numbers, ie I have a column full of product codes and i want to be able to select the cells and run a macro which will bring up a box that will allow the user to enter the text of their choosing and when they click ok will insert their text before the current numbers in each of the selected cells. Any help would be much appreciated ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Validation Input Text | Excel Discussion (Misc queries) | |||
copy text box input into another text box automatically | Excel Discussion (Misc queries) | |||
How to input additional text to multiple of existing cells that has text | Excel Worksheet Functions | |||
Using text value in cell as input for another | Excel Worksheet Functions | |||
Input from Text file | Excel Programming |