Categories

A

art

Hello all:

I am making a userform with a text box and a RefEdit button. The user enters
text in the textbox, and then selects a range with the RefeEdit. Now I need
to apply the word from the text box in each cell from the range. However I
need the current text in the range should stay, just the text from the text
box should be "Added" before the original text.

Please help me figure this out.

Thanks.
 
D

dmoney

untested -- but might work


For Each c In 'the range you want to use
c.Formula = textbox1.text & c.value
End If
Next
 
A

art

Something is wrong. First the error was end with out if. So I took it out.
The the error was on the first line: For Each c In Categories.RefEdit1.Value.
Please help me finish this.

Thanks for your help.
 
K

keiji kounoike

I don't know what your Categories in Categories.RefEdit1.Value means. Is
that your object name of your Userform?
Anyway, add the commandbutton in your userform and try the code below.
first, input data in both textbox and refedit, then click the commandbutton.

Private Sub CommandButton1_Click()
Dim rng As Range
For Each rng In Range(Me.RefEdit1.Value)
rng.Value = Me.TextBox1.Value & rng.Value
Next
End Sub

keiji
 
Top