Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting rows by name in cell

I have a list of about 40 people who work here. each week there is a
excel spreadsheet made up with a list of each case taking on in tha
week and is sorted by each persons first name. These 40 people ar
split into 4 teams. (my job = )Another spreadsheet needs to be made u
by macro, of what cases were taking on by each group. i would like t
know if there is away of deleting a row on the basis of what name is i
the column through macro.

some help on this would great,

Thanks,
Cathal

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Deleting rows by name in cell

Dim icol as long, i as long
Dim lastRow as Long, Dim firstRow as Long
firstRow = 1
icol = 3 ' column C as an example
lastRow = cells(rows.count,icol).End(xlup).Row
for i = lastrow to firstrow
if cells(i,icol).Value = "Mortimer" then
cells(i,icol).EntireRow.delete
end if
Next


--
Regards,
Tom Ogilvy

"CPower " wrote in message
...
I have a list of about 40 people who work here. each week there is an
excel spreadsheet made up with a list of each case taking on in that
week and is sorted by each persons first name. These 40 people are
split into 4 teams. (my job = )Another spreadsheet needs to be made up
by macro, of what cases were taking on by each group. i would like to
know if there is away of deleting a row on the basis of what name is in
the column through macro.

some help on this would great,

Thanks,
Cathal.


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting rows by name in cell

Thanks a millon Tom.

I understand whats happening in the code but for some reason when i run
it nothing happens i.e does not delete the rows of the specified people
= If Cells(i, icol).Value = "Alan, Victor, Jason, Maria". Can u help me
with this?

here is the code as i put it in:

Dim icol As Long, i As Long
Dim lastRow As Long
Dim firstRow As Long
firstRow = 1
icol = 1 ' column A
lastRow = Cells(Rows.Count, icol).End(xlUp).Row
For i = lastRow To firstRow
If Cells(i, icol).Value = "Alan, Victor, Jason, Maria" Then
Cells(i, icol).EntireRow.Delete
End If
Next

Regards
Cathal.


---
Message posted from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting rows by name in cell

All the specified names that i want to delete are in column A, but whe
i set icol = 1 it runs but does not work, can anyone please let me wha
know what im doing wrong? not an expert on this code so it could b
somtething simple for all i know!!

Thanks guys,
Cathal

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Deleting rows by name in cell

Dim icol As Long, i As Long
Dim lastRow As Long
Dim firstRow As Long
firstRow = 1
icol = 1 ' column A
lastRow = Cells(Rows.Count, icol).End(xlUp).Row
For i = lastRow To firstRow
If Cells(i, icol).Value = "Alan" or _
Cells(i,icol).Value = "Victor" or _
Cells(i,icol).Value = "Jason" or _
Cells(i,icol).Value = "Maria" Then
Cells(i, icol).EntireRow.Delete
End If
Next
"CPower " wrote in message
...
All the specified names that i want to delete are in column A, but when
i set icol = 1 it runs but does not work, can anyone please let me what
know what im doing wrong? not an expert on this code so it could be
somtething simple for all i know!!

Thanks guys,
Cathal.


---
Message posted from http://www.ExcelForum.com/



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
Deleting rows based on values in a a cell in the row Martin New Users to Excel 1 January 25th 09 11:46 AM
Retain cell reference after deleting rows Otto Moehrbach[_2_] Excel Worksheet Functions 2 November 18th 08 06:48 PM
deleting entire rows with the same cell value in the first column Pedro F. Excel Discussion (Misc queries) 3 January 11th 06 07:10 PM
Deleting rows based on a cell value JPriest Excel Worksheet Functions 3 August 12th 05 05:44 PM
Deleting Rows from using a target cell Mike[_43_] Excel Programming 1 August 11th 03 06:19 PM


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