Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 334
Default I need to determine the last line in a column and then add data

Is there a way to add a row of data to a worksheet using a macro? I need to
determine the last row of data already there and then append on the next row
some static data. The rows of data will change each time I use this workbook.

Example:
On a cloumn with 1224 rows of data, I need to add on the 1225 row the number
1000 automatically. The rows of data will change each time I use this
workbook.

Thank you

Ric
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default I need to determine the last line in a column and then add data

this line will select the first blank cell in column A on the active sheet.

activesheet.cells(rows.count, "A").end(xlup).offset(1, 0).select
--
HTH...

Jim Thomlinson


"Rick" wrote:

Is there a way to add a row of data to a worksheet using a macro? I need to
determine the last row of data already there and then append on the next row
some static data. The rows of data will change each time I use this workbook.

Example:
On a cloumn with 1224 rows of data, I need to add on the 1225 row the number
1000 automatically. The rows of data will change each time I use this
workbook.

Thank you

Ric

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 334
Default I need to determine the last line in a column and then add dat

I actually have tried this and believe it is working but how would I enter
the data in this cell? I have tried things such as ActiveCell.FormulaR1C1 =
"1000" but I must be missing something.

"Jim Thomlinson" wrote:

this line will select the first blank cell in column A on the active sheet.

activesheet.cells(rows.count, "A").end(xlup).offset(1, 0).select
--
HTH...

Jim Thomlinson


"Rick" wrote:

Is there a way to add a row of data to a worksheet using a macro? I need to
determine the last row of data already there and then append on the next row
some static data. The rows of data will change each time I use this workbook.

Example:
On a cloumn with 1224 rows of data, I need to add on the 1225 row the number
1000 automatically. The rows of data will change each time I use this
workbook.

Thank you

Ric

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default I need to determine the last line in a column and then add dat

Try this

activesheet.cells(rows.count, "A").end(xlup).offset(1, 0).select
activecell.value = "This"
Activecell.offset(0, 1) = "That"
--
HTH...

Jim Thomlinson


"Rick" wrote:

I actually have tried this and believe it is working but how would I enter
the data in this cell? I have tried things such as ActiveCell.FormulaR1C1 =
"1000" but I must be missing something.

"Jim Thomlinson" wrote:

this line will select the first blank cell in column A on the active sheet.

activesheet.cells(rows.count, "A").end(xlup).offset(1, 0).select
--
HTH...

Jim Thomlinson


"Rick" wrote:

Is there a way to add a row of data to a worksheet using a macro? I need to
determine the last row of data already there and then append on the next row
some static data. The rows of data will change each time I use this workbook.

Example:
On a cloumn with 1224 rows of data, I need to add on the 1225 row the number
1000 automatically. The rows of data will change each time I use this
workbook.

Thank you

Ric

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 334
Default I need to determine the last line in a column and then add dat

Your example was perfect! Thank you.

"Jim Thomlinson" wrote:

Try this

activesheet.cells(rows.count, "A").end(xlup).offset(1, 0).select
activecell.value = "This"
Activecell.offset(0, 1) = "That"
--
HTH...

Jim Thomlinson


"Rick" wrote:

I actually have tried this and believe it is working but how would I enter
the data in this cell? I have tried things such as ActiveCell.FormulaR1C1 =
"1000" but I must be missing something.

"Jim Thomlinson" wrote:

this line will select the first blank cell in column A on the active sheet.

activesheet.cells(rows.count, "A").end(xlup).offset(1, 0).select
--
HTH...

Jim Thomlinson


"Rick" wrote:

Is there a way to add a row of data to a worksheet using a macro? I need to
determine the last row of data already there and then append on the next row
some static data. The rows of data will change each time I use this workbook.

Example:
On a cloumn with 1224 rows of data, I need to add on the 1225 row the number
1000 automatically. The rows of data will change each time I use this
workbook.

Thank you

Ric



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default I need to determine the last line in a column and then add data

lastrow = cells(rows.count,1).End(xlup).row
nextrow = lastrow + 1

--
Regards,
Tom Ogilvy


"Rick" wrote in message
...
Is there a way to add a row of data to a worksheet using a macro? I need

to
determine the last row of data already there and then append on the next

row
some static data. The rows of data will change each time I use this

workbook.

Example:
On a cloumn with 1224 rows of data, I need to add on the 1225 row the

number
1000 automatically. The rows of data will change each time I use this
workbook.

Thank you

Ric



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default I need to determine the last line in a column and then add data

this should total column a:

lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Range("A" & lastrow).Offset(1, 0).Formula = "=sum(A1:a" & lastrow & ")"

--


Gary


"Rick" wrote in message
...
Is there a way to add a row of data to a worksheet using a macro? I need
to
determine the last row of data already there and then append on the next
row
some static data. The rows of data will change each time I use this
workbook.

Example:
On a cloumn with 1224 rows of data, I need to add on the 1225 row the
number
1000 automatically. The rows of data will change each time I use this
workbook.

Thank you

Ric



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
delete duplicate record but only determine 1 column data AskExcel Excel Worksheet Functions 3 January 28th 06 01:11 PM
Can I get Excel to determine the line curve formula without graph. Cadelima Excel Discussion (Misc queries) 8 December 20th 05 09:57 PM
How to Determine if column of certain rows in a text file has data? Tony Excel Programming 1 February 1st 05 08:01 AM
formula to determine the first column containing any data sd Excel Worksheet Functions 5 November 9th 04 08:06 PM
Determine the last column of data Bryan Kelly Excel Programming 7 July 7th 04 02:13 AM


All times are GMT +1. The time now is 10:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"