Text Box
First, I don't think you'll be able to use a range named R2. It looks like the
address of a cell in A1 reference style--or it looks like the address of row 2
in R1C1 reference style.
And how do you define a new cell in that range--the first empty cell you find?
And how do you look through the range--by rows, by columns???
I changed the range name to _R2 in this sample.
Option Explicit
Private Sub CommandButton1_Click()
Dim myCell As Range
Dim myRng As Range
Dim FoundIt As Boolean
Set myRng = Worksheets("sheet1").Range("_R2")
FoundIt = False
For Each myCell In myRng.Cells
If IsEmpty(myCell.Value) Then
'found it
myCell.Value = Me.TextBox1.Value
FoundIt = True
Exit For
End If
Next myCell
If FoundIt = False Then
MsgBox "no ""new"" cells in range"
End If
End Sub
N.F wrote:
I have in a userform a text box available for inputing text. Iam having
trouble with the following: I dont know how to make it so that the user can
input text in the textbox within Userform and have him/her click a command
button when done, and this text in the text box I want it to appear in a new
cell of a range named "R2".
Any ideas???
--
Dave Peterson
|