Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding text to a selection of cells..

Status
Not open for further replies.

funkmonsteruk

IS-IT--Management
Feb 8, 2002
210
GB
I'm using some relatively simple vba which allows the user to select a range of cells, click a button and the cells are merged, word wrapped and turned a different color. However, i would like to add a new feature which allows them to insert text into the selection.

When the button is clicked i want a dialogue box to appear which prompts the user to enter some text to be added to the selected range, then i want the text to be added to the selected range.

Can anybody help...?
 
You could use an InputBox like this:

Code:
Dim strText As String

strText = InputBox("Enter text string here", "Text String")
Selection.Merge
Selection.Interior.ColorIndex = 3
Selection.WrapText = True
Selection = strText

Or you could create a custom form by adding a UserForm to your current module. If you need help with userforms, post here. Otherwise, the InputBox works great.

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top