Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Delete Rows on cell content?

I'm starting with a work schedule spreadsheet generated from an Access DB.
Column A contains employee names, B contains a segement code, and columns C:G
contain times. It looks like this:

EmpName Code 14-Feb 15-Feb
Smith, Erin Work 10:00 10:00
Smith, Erin Break 12:00 12:00
Smith, Erin Work 12:15 12:15
Smith, Erin Lunch 14:15 14:15
Smith, Erin Work 14:30 14:30
Smith, Erin Break 16:30 16:30
Smith, Erin Work 16:45 16:45

I'm dealing with about 400 employees, each of whom have entries like this. I
would like to be able to delete all of the rows in the used range that have
"Work" in column B, leaving me with break and lunch times. Can this be
accomplished with some VBA code? Much thanks in advance!
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default Delete Rows on cell content?

sub delerow ()
for u = sheet1.usedrange.rows.count to 1 step - 1
if cells(u,2).value = "Work" then Rows(trim(str(u))).Entirerow.delete
next
end sub

"fpd833" wrote:

I'm starting with a work schedule spreadsheet generated from an Access DB.
Column A contains employee names, B contains a segement code, and columns C:G
contain times. It looks like this:

EmpName Code 14-Feb 15-Feb
Smith, Erin Work 10:00 10:00
Smith, Erin Break 12:00 12:00
Smith, Erin Work 12:15 12:15
Smith, Erin Lunch 14:15 14:15
Smith, Erin Work 14:30 14:30
Smith, Erin Break 16:30 16:30
Smith, Erin Work 16:45 16:45

I'm dealing with about 400 employees, each of whom have entries like this. I
would like to be able to delete all of the rows in the used range that have
"Work" in column B, leaving me with break and lunch times. Can this be
accomplished with some VBA code? Much thanks in advance!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Delete Rows on cell content?

Sweet! Thanks Ben!

"ben" wrote:

sub delerow ()
for u = sheet1.usedrange.rows.count to 1 step - 1
if cells(u,2).value = "Work" then Rows(trim(str(u))).Entirerow.delete
next
end sub

"fpd833" wrote:

I'm starting with a work schedule spreadsheet generated from an Access DB.
Column A contains employee names, B contains a segement code, and columns C:G
contain times. It looks like this:

EmpName Code 14-Feb 15-Feb
Smith, Erin Work 10:00 10:00
Smith, Erin Break 12:00 12:00
Smith, Erin Work 12:15 12:15
Smith, Erin Lunch 14:15 14:15
Smith, Erin Work 14:30 14:30
Smith, Erin Break 16:30 16:30
Smith, Erin Work 16:45 16:45

I'm dealing with about 400 employees, each of whom have entries like this. I
would like to be able to delete all of the rows in the used range that have
"Work" in column B, leaving me with break and lunch times. Can this be
accomplished with some VBA code? Much thanks in advance!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Delete Rows on cell content?

Now a dumb formatting question.....know of an easy way to color fill colums
A:G based on the name? I'd like to fill the cells of every other employee
with green....so it will look something like a ledger sheet. Not every
employee will have the same number of name entries in column A though. Or is
there a way to insert a blank row between the names? Just trying to make it
easier to read. Thanks!

"fpd833" wrote:

Sweet! Thanks Ben!

"ben" wrote:

sub delerow ()
for u = sheet1.usedrange.rows.count to 1 step - 1
if cells(u,2).value = "Work" then Rows(trim(str(u))).Entirerow.delete
next
end sub

"fpd833" wrote:

I'm starting with a work schedule spreadsheet generated from an Access DB.
Column A contains employee names, B contains a segement code, and columns C:G
contain times. It looks like this:

EmpName Code 14-Feb 15-Feb
Smith, Erin Work 10:00 10:00
Smith, Erin Break 12:00 12:00
Smith, Erin Work 12:15 12:15
Smith, Erin Lunch 14:15 14:15
Smith, Erin Work 14:30 14:30
Smith, Erin Break 16:30 16:30
Smith, Erin Work 16:45 16:45

I'm dealing with about 400 employees, each of whom have entries like this. I
would like to be able to delete all of the rows in the used range that have
"Work" in column B, leaving me with break and lunch times. Can this be
accomplished with some VBA code? Much thanks in advance!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete Rows on cell content?

Perhaps see Chip Pearson's page on this:

http://www.cpearson.com/excel/banding.htm

--
Regards,
Tom Ogilvy

"fpd833" wrote in message
...
Now a dumb formatting question.....know of an easy way to color fill

colums
A:G based on the name? I'd like to fill the cells of every other employee
with green....so it will look something like a ledger sheet. Not every
employee will have the same number of name entries in column A though. Or

is
there a way to insert a blank row between the names? Just trying to make

it
easier to read. Thanks!

"fpd833" wrote:

Sweet! Thanks Ben!

"ben" wrote:

sub delerow ()
for u = sheet1.usedrange.rows.count to 1 step - 1
if cells(u,2).value = "Work" then Rows(trim(str(u))).Entirerow.delete
next
end sub

"fpd833" wrote:

I'm starting with a work schedule spreadsheet generated from an

Access DB.
Column A contains employee names, B contains a segement code, and

columns C:G
contain times. It looks like this:

EmpName Code 14-Feb 15-Feb
Smith, Erin Work 10:00 10:00
Smith, Erin Break 12:00 12:00
Smith, Erin Work 12:15 12:15
Smith, Erin Lunch 14:15 14:15
Smith, Erin Work 14:30 14:30
Smith, Erin Break 16:30 16:30
Smith, Erin Work 16:45 16:45

I'm dealing with about 400 employees, each of whom have entries like

this. I
would like to be able to delete all of the rows in the used range

that have
"Work" in column B, leaving me with break and lunch times. Can this

be
accomplished with some VBA code? Much thanks in advance!



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 cell content Chuck Neal Excel Discussion (Misc queries) 3 June 14th 06 05:05 PM
Delete rows by content Raza Excel Worksheet Functions 3 November 19th 05 09:20 PM
Hide/Delete entire rows based in the content of one cell Clueless Excel Discussion (Misc queries) 2 October 3rd 05 02:40 PM
Delete Rows Based On Content halem2[_39_] Excel Programming 0 October 12th 04 03:27 PM
Delete Rows Based On Content halem2[_38_] Excel Programming 1 October 12th 04 03:16 PM


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