Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Inserting value at end of range

Hey guys

Lets say I have Range A1:A100 and a textbox(Textbox1).
Currently there are values in A1:A25. I need for for
TextBox1 value to be inserted in the next empty cell in
the range. The next empty cell in the range is A26, so
therefor this is where I would like Textbox1.value to be
inserted.

How would write this?

I usualy just do a count formula+1 in any cell and have
the vba code refer to that cell as the location for the
next value to be inserted, but this can clutter up my
worksheet with variables.

Thanx

Todd Huttenstine
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Inserting value at end of range

Try this

Range("A" & Rows.Count).End(xlUp)(2) = TextBox1.Value


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Todd Huttenstine" wrote in message ...
Hey guys

Lets say I have Range A1:A100 and a textbox(Textbox1).
Currently there are values in A1:A25. I need for for
TextBox1 value to be inserted in the next empty cell in
the range. The next empty cell in the range is A26, so
therefor this is where I would like Textbox1.value to be
inserted.

How would write this?

I usualy just do a count formula+1 in any cell and have
the vba code refer to that cell as the location for the
next value to be inserted, but this can clutter up my
worksheet with variables.

Thanx

Todd Huttenstine



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Inserting value at end of range

Todd

Sub find_last_plus_one()
Cells(Rows.Count, 1).End(xlUp) _
.Offset(1, 0).Activate
End Sub

Will activate first blank cell in column A

Gord Dibben XL2002

On Fri, 28 Nov 2003 13:25:22 -0800, "Todd Huttenstine"
wrote:

Hey guys

Lets say I have Range A1:A100 and a textbox(Textbox1).
Currently there are values in A1:A25. I need for for
TextBox1 value to be inserted in the next empty cell in
the range. The next empty cell in the range is A26, so
therefor this is where I would like Textbox1.value to be
inserted.

How would write this?

I usualy just do a count formula+1 in any cell and have
the vba code refer to that cell as the location for the
next value to be inserted, but this can clutter up my
worksheet with variables.

Thanx

Todd Huttenstine


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Inserting value at end of range

Ok thanx, one last question...

I also have 1 checkbox1. How do I get it to perform that
code if checkbox1 is checked? If checkbox1 is not
checked, dont do the code.

Thanx


-----Original Message-----
Try this

Range("A" & Rows.Count).End(xlUp)(2) = TextBox1.Value


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Todd Huttenstine"

wrote in message news:030101c3b5f6$21ae7710
...
Hey guys

Lets say I have Range A1:A100 and a textbox(Textbox1).
Currently there are values in A1:A25. I need for for
TextBox1 value to be inserted in the next empty cell in
the range. The next empty cell in the range is A26, so
therefor this is where I would like Textbox1.value to be
inserted.

How would write this?

I usualy just do a count formula+1 in any cell and have
the vba code refer to that cell as the location for the
next value to be inserted, but this can clutter up my
worksheet with variables.

Thanx

Todd Huttenstine



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Inserting value at end of range

Todd,

Use something like

If Me.CheckBox1.Value = True Then
Range("A" & Rows.Count).End(xlUp)(2) = TextBox1.Value
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Todd Huttenstine" wrote in
message ...
Ok thanx, one last question...

I also have 1 checkbox1. How do I get it to perform that
code if checkbox1 is checked? If checkbox1 is not
checked, dont do the code.

Thanx


-----Original Message-----
Try this

Range("A" & Rows.Count).End(xlUp)(2) = TextBox1.Value


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Todd Huttenstine"

wrote in message news:030101c3b5f6$21ae7710
...
Hey guys

Lets say I have Range A1:A100 and a textbox(Textbox1).
Currently there are values in A1:A25. I need for for
TextBox1 value to be inserted in the next empty cell in
the range. The next empty cell in the range is A26, so
therefor this is where I would like Textbox1.value to be
inserted.

How would write this?

I usualy just do a count formula+1 in any cell and have
the vba code refer to that cell as the location for the
next value to be inserted, but this can clutter up my
worksheet with variables.

Thanx

Todd Huttenstine



.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Inserting value at end of range

Works perfect.

Thanx

-----Original Message-----
Todd,

Use something like

If Me.CheckBox1.Value = True Then
Range("A" & Rows.Count).End(xlUp)(2) = TextBox1.Value
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Todd Huttenstine"

wrote in
message ...
Ok thanx, one last question...

I also have 1 checkbox1. How do I get it to perform

that
code if checkbox1 is checked? If checkbox1 is not
checked, dont do the code.

Thanx


-----Original Message-----
Try this

Range("A" & Rows.Count).End(xlUp)(2) = TextBox1.Value


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Todd Huttenstine"


wrote in message news:030101c3b5f6$21ae7710
...
Hey guys

Lets say I have Range A1:A100 and a textbox

(Textbox1).
Currently there are values in A1:A25. I need for for
TextBox1 value to be inserted in the next empty cell

in
the range. The next empty cell in the range is A26,

so
therefor this is where I would like Textbox1.value

to be
inserted.

How would write this?

I usualy just do a count formula+1 in any cell and

have
the vba code refer to that cell as the location for

the
next value to be inserted, but this can clutter up my
worksheet with variables.

Thanx

Todd Huttenstine


.



.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Inserting value at end of range

Ron de Bruin wrote

Range("A" & Rows.Count).End(xlUp)(2) = TextBox1.Value


Curious. What does the (2) after (xlUp) mean?

--
David
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Inserting value at end of range

It's the equivalent of
Range("A" & Rows.Count).End(xlUp).offset(1,0)

(it comes down one row.)

Alan Beban has some notes at Chip Pearson's site that you may want to
read/print that have some more variations for using ranges.
http://www.cpearson.com/excel/cells.htm

David Turner wrote:

Ron de Bruin wrote

Range("A" & Rows.Count).End(xlUp)(2) = TextBox1.Value


Curious. What does the (2) after (xlUp) mean?

--
David


--

Dave Peterson

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Inserting value at end of range


That works just fine ... unless you have more data below the first blan
row, in which case you end up appending the new data at the very botto
instead of the relative bottom ... if you know what I mean.

I would suggest, instead ...

Dim myRange as Range

Range("A1").Select
Set myRange = ActiveCell.CurrentRegion
LastRow = myRange.Cells(myRange.Cells.Count).Row

the, insert the new data at LastRow +

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Inserting value at end of range

Dave Peterson wrote

It's the equivalent of
Range("A" & Rows.Count).End(xlUp).offset(1,0)

(it comes down one row.)

Alan Beban has some notes at Chip Pearson's site that you may want to
read/print that have some more variations for using ranges.
http://www.cpearson.com/excel/cells.htm


Thanks.

--
David
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
Inserting a row within a range that is defined in a sum function Victor[_2_] Excel Discussion (Misc queries) 2 November 25th 09 04:32 PM
Input Boxes 4 Inserting A Range In A Formula FARAZ QURESHI Excel Discussion (Misc queries) 5 March 2nd 08 06:30 PM
Inserting a range of cells Shazzer Excel Worksheet Functions 1 July 4th 07 06:53 PM
Inserting selected range into Word document Ed Stevens[_2_] Excel Programming 2 October 15th 03 03:35 PM
excel 97 : automatically inserting a specific value for a range? JMCN Excel Programming 3 September 30th 03 04:25 PM


All times are GMT +1. The time now is 01:37 AM.

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"