Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Add text per user input

I would like to have a macro that when run would prompt the user to select
rows of data and then prompt the user to input information for the cell. The
new information would be appended to the beginning of cell "D" for each row
selected. There will be 4 digits in each cell "D". Therefore, if "D"
currently contains 1234 and the user selects this cell, runs the macro and
enters 555, then cell "D" woul display 5551234. Can someone help?

Thanks in advance,

BlueAngel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Add text per user input

Sub Add_Text_Left()
Dim Cell As Range
Dim moretext As String
Dim thisrng As Range
On Error GoTo endit
Set thisrng = Range(ActiveCell.Address & "," & Selection.Address) _
.SpecialCells(xlCellTypeConstants, xlTextValues)
moretext = InputBox("Enter your Text")
For Each Cell In thisrng
Cell.Value = moretext & Cell.Value
Next
Exit Sub
endit:
MsgBox "only formulas in range"
End Sub

Assumes user will select a range of cells prior to running.


Gord Dibben MS Excel MVP

On Mon, 8 Mar 2010 07:30:01 -0800, BlueAngel
wrote:

I would like to have a macro that when run would prompt the user to select
rows of data and then prompt the user to input information for the cell. The
new information would be appended to the beginning of cell "D" for each row
selected. There will be 4 digits in each cell "D". Therefore, if "D"
currently contains 1234 and the user selects this cell, runs the macro and
enters 555, then cell "D" woul display 5551234. Can someone help?

Thanks in advance,

BlueAngel


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
BRAND NEW USER -: PROBLEMS WITH LIST AND TEXT BOX INPUT [email protected] Excel Programming 0 April 20th 07 08:04 AM
BRAND NEW USER -: PROBLEMS WITH LIST AND TEXT BOX INPUT [email protected] Excel Programming 0 April 19th 07 12:28 AM
Excel VBA- Get user input, search the for match, output to text file gnileo Excel Programming 1 January 8th 04 07:59 PM
CODE to select range based on User Input or Value of Input Field Sandi Gauthier Excel Programming 4 December 8th 03 03:22 PM
How to get User input from Userform Text box K[_3_] Excel Programming 1 September 9th 03 10:08 PM


All times are GMT +1. The time now is 04:48 PM.

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"