#1   Report Post  
Posted to microsoft.public.excel.programming
ali ali is offline
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation Input Text Chris waller Excel Discussion (Misc queries) 1 March 5th 09 09:30 PM
copy text box input into another text box automatically Sigma Dan Excel Discussion (Misc queries) 2 July 26th 07 03:24 PM
How to input additional text to multiple of existing cells that has text [email protected] Excel Worksheet Functions 2 June 21st 05 01:46 AM
Using text value in cell as input for another Alan Excel Worksheet Functions 1 November 26th 04 02:38 AM
Input from Text file BOMB3RMAN[_4_] Excel Programming 2 November 4th 03 03:00 AM


All times are GMT +1. The time now is 09:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"