Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Extracting info from different rows (& columns)

Dear all

Sorry to pester, but, I am being asked to do more and more spreadsheets with
several hundred lines of info, a lot of which needs deleting.
How do I get a simple macro that starts at Row a1, and continues to row
(say) 751(or whatever the final row is), but deletes any row in total that
has a
number 5 ( or other character )in the row on column A. although I am reading
walkenbach's book, I
cant find a good example that does this. Also in order not to pester, can
anyone recommend a good training book, because I intend to try and improve
my macro skills.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Extracting info from different rows (& columns)

Noel,

Try this

cLastRow = Cells(Rows.Count,"A").End(xlUp).Row
For i = cLastRow To 1
If Cells(i,"A").Value = 5 Then
Cells(i,"A").Entirerow.Delete
End If
Next i

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Noel Boland" wrote in message
...
Dear all

Sorry to pester, but, I am being asked to do more and more spreadsheets

with
several hundred lines of info, a lot of which needs deleting.
How do I get a simple macro that starts at Row a1, and continues to row
(say) 751(or whatever the final row is), but deletes any row in total that
has a
number 5 ( or other character )in the row on column A. although I am

reading
walkenbach's book, I
cant find a good example that does this. Also in order not to pester, can
anyone recommend a good training book, because I intend to try and improve
my macro skills.





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Extracting info from different rows (& columns)

When deleting rows, you should move from the highest numbered row to the
lowest

Dim rng as Range, i as long
set rng = Cells(rows.count,1).End(xlup)
for i = rng.row. to 1 step -1
if cells(i,1).Value = 5 then
cells(i,1).Entirerow.Delete
end if
Next

There are faster ways, but this should be a good start.

--
Regards,
Tom Ogilvy

"Noel Boland" wrote in message
...
Dear all

Sorry to pester, but, I am being asked to do more and more spreadsheets

with
several hundred lines of info, a lot of which needs deleting.
How do I get a simple macro that starts at Row a1, and continues to row
(say) 751(or whatever the final row is), but deletes any row in total that
has a
number 5 ( or other character )in the row on column A. although I am

reading
walkenbach's book, I
cant find a good example that does this. Also in order not to pester, can
anyone recommend a good training book, because I intend to try and improve
my macro skills.





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
Moving info from rows to columns Mary Lou[_2_] Excel Worksheet Functions 2 October 28th 09 01:34 AM
Concatenate info from columns into rows jbjtc Excel Discussion (Misc queries) 2 December 7th 07 02:57 PM
Numbering rows in A1 only no matter info in other columns. Pamela New Users to Excel 3 May 2nd 06 09:29 PM
extracting rows/columns Tiffani Excel Discussion (Misc queries) 3 March 6th 06 04:14 PM
Rearrange info in rows to columns - HELP! LaVerne Excel Discussion (Misc queries) 0 June 20th 05 09:40 PM


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