ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   deleteing a range from one cell within it? (https://www.excelbanter.com/excel-programming/337892-deleteing-range-one-cell-within.html)

Greg Little

deleteing a range from one cell within it?
 
Hello, all-
I'm trying to select and delete a range of cells, based on one cell
contained within the range. Can someone suggest a remedy? Basically, it is from
a time sheet for multiple people, and each person is a 12 row by 15 column
range, repeated down the worksheet. I want to select the employee's number,
delete that person's range and close up the remaining cells. Thanks in advance,
I'm pretty frustrated right now.

Greg Little
glittle.at.sprynet.com

PY & Associates[_3_]

deleteing a range from one cell within it?
 
If the emp nr is top left corner,
range(activecell,activecell.Offset(12,1)).EntireRo w.delete
should work

"Greg Little" wrote:

Hello, all-
I'm trying to select and delete a range of cells, based on one cell
contained within the range. Can someone suggest a remedy? Basically, it is from
a time sheet for multiple people, and each person is a 12 row by 15 column
range, repeated down the worksheet. I want to select the employee's number,
delete that person's range and close up the remaining cells. Thanks in advance,
I'm pretty frustrated right now.

Greg Little
glittle.at.sprynet.com


Rowan[_2_]

deleteing a range from one cell within it?
 
Range(ActiveCell, ActiveCell.Offset(11, 1)).EntireRow.Delete

will prevent you deleting the first row of the next employee.

Regards
Rowan

"PY & Associates" wrote:

If the emp nr is top left corner,
range(activecell,activecell.Offset(12,1)).EntireRo w.delete
should work

"Greg Little" wrote:

Hello, all-
I'm trying to select and delete a range of cells, based on one cell
contained within the range. Can someone suggest a remedy? Basically, it is from
a time sheet for multiple people, and each person is a 12 row by 15 column
range, repeated down the worksheet. I want to select the employee's number,
delete that person's range and close up the remaining cells. Thanks in advance,
I'm pretty frustrated right now.

Greg Little
glittle.at.sprynet.com


Greg Little

deleteing a range from one cell within it?
 
Yup, that does it, after offsetting to the top left corner from the key cell.
Thank you all , I spent WAY too much time trying to make it all harder than it
needed to be. Thanks again.
Greg Little

Range(ActiveCell, ActiveCell.Offset(11, 1)).EntireRow.Delete

will prevent you deleting the first row of the next employee.

Regards
Rowan

"PY & Associates" wrote:

If the emp nr is top left corner,
range(activecell,activecell.Offset(12,1)).EntireRo w.delete
should work

"Greg Little" wrote:

Hello, all-
I'm trying to select and delete a range of cells, based on one cell
contained within the range. Can someone suggest a remedy? Basically, it is from
a time sheet for multiple people, and each person is a 12 row by 15 column
range, repeated down the worksheet. I want to select the employee's number,
delete that person's range and close up the remaining cells. Thanks in advance,
I'm pretty frustrated right now.

Greg Little
glittle.at.sprynet.com



Dave Peterson

deleteing a range from one cell within it?
 
It might be easier to read:

activecell.resize(12).entirerow.delete

But I think I'd add a little validation--just to make sure I'm on a correct
cell.


Greg Little wrote:

Hello, all-
I'm trying to select and delete a range of cells, based on one cell
contained within the range. Can someone suggest a remedy? Basically, it is from
a time sheet for multiple people, and each person is a 12 row by 15 column
range, repeated down the worksheet. I want to select the employee's number,
delete that person's range and close up the remaining cells. Thanks in advance,
I'm pretty frustrated right now.

Greg Little
glittle.at.sprynet.com


--

Dave Peterson


All times are GMT +1. The time now is 12:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com