Inserting data within a named range..HELP

  • Thread starter Thread starter sulrich
  • Start date Start date
S

sulrich

I'm not an expert in vba in excel, however I would like some help. I
have a worksheet with a named range called "Data". And, also on the
worksheet I have a command button that initiates a userform. On that
userform I have TextBox1.Value and TextBox2.Value...after the OK button
is clicked within the userform, it inserts the data from the userform in
the last row of that named range. I have part of the code to that adds
the data to the worksheet, but the named range area stays the same. How
do I get this to work. This is what I have so far:

Sheets("Sheet1").Range("A65536").End(xlUp)(2, 1).Value = TextBox1.Value

Sheets("Sheet1").Range("A65536").End(xlUp)(1, 2).Value = TextBox2.Value

Sheets("Sheet1").Range("A65536").End(xlUp)(1, 3).Value = TextBox3.Value


Thanks in advance...
 
Thanks Tom..
One more question....If I have 2 named ranges(let's say "data" an
"data1"), and depending on what the user inputs in TextBox1.Valu
determines on what *named range* the data gets inserted into. Fo
example, if TextBox1.Value = "Blue", information from TextBox1
TextBox2 and TextBox3 will be inserted into the named range "Data".
However, the data is being inserted onto the worksheet, but how do
code it to insert into a specified named range?
The range for Data1 is =Sheet1!$A$1:$E$10 and Data2 i
=Sheet1!$A$12:$E$19.

Thank you inadvance.
:confused
 
Back
Top