Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Adding/removing rows in Excel

Is there an easy way of making code change automatically
to make allowance for adding or removing rows in a
spreadsheet, without manually changing the code ?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Adding/removing rows in Excel

Assume column A can be used to find the number of rows

set rng = Range(cells(1,1),cells(rows.count,1).End(xlup))

for each cell in rng

If you have a data table/database construct

set rng = range("a1").CurrentRegion

in either case

Dim lastrow as Long
lastrow = rng.rows(rng.row.count).row

for i = lastrow to 1 step -1
if cells(lastrow,1).Value = 0 then
cells(lastrow,1).EntireRow.Delete
end if
Next

as an example.
--
Regards,
Tom Ogilvy



"Don" wrote in message
...
Is there an easy way of making code change automatically
to make allowance for adding or removing rows in a
spreadsheet, without manually changing the code ?



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
Adding or removing rows Chris Excel Discussion (Misc queries) 12 January 10th 10 12:48 PM
Adding/Removing Rows Automatically. GEM Excel Discussion (Misc queries) 1 March 20th 09 12:50 AM
Removing Blank Rows in an excel spreadsheet Phyllis Excel Discussion (Misc queries) 5 December 18th 08 12:51 AM
Automatically adjusting # of entries by adding/removing rows Alice Excel Worksheet Functions 1 March 13th 08 08:15 AM
Removing excess rows in excel phil Excel Worksheet Functions 2 August 31st 06 06:53 PM


All times are GMT +1. The time now is 08:54 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"