![]() |
Offset Code
I have the following code that deletes a certain cell...
Cells(i1, "N").Delete Shift:=xlShiftUp I would like it to also delete the next 4 cells to the right using the same delete method? I would assume I would have to use an offset method. Can anyone please tell me how to do this? Thank you Todd Huttenstine |
Offset Code
Todd,
Try: Cells(i1, "N").Resize(,4).Delete Shift:=xlShiftUp John "Todd Huttenstine" wrote in message ... I have the following code that deletes a certain cell... Cells(i1, "N").Delete Shift:=xlShiftUp I would like it to also delete the next 4 cells to the right using the same delete method? I would assume I would have to use an offset method. Can anyone please tell me how to do this? Thank you Todd Huttenstine |
Offset Code
That did not work.
-----Original Message----- Todd, Try: Cells(i1, "N").Resize(,4).Delete Shift:=xlShiftUp John "Todd Huttenstine" wrote in message ... I have the following code that deletes a certain cell... Cells(i1, "N").Delete Shift:=xlShiftUp I would like it to also delete the next 4 cells to the right using the same delete method? I would assume I would have to use an offset method. Can anyone please tell me how to do this? Thank you Todd Huttenstine . |
Offset Code
I used the below method to delete the next 4 cells to the
right of Cells(i1, "N"), but there seems as though there would be an easier way to do this. I have to put the code for the cells I want to delete before the code to delete the actual Cells(i1, "N") so I can use that as a reference. Cells(i1, "N").Offset(0, 1).Delete Shift:=xlShiftUp Cells(i1, "N").Offset(0, 2).Delete Shift:=xlShiftUp Cells(i1, "N").Offset(0, 3).Delete Shift:=xlShiftUp Cells(i1, "N").Offset(0, 4).Delete Shift:=xlShiftUp Cells(i1, "N").Delete Shift:=xlShiftUp -----Original Message----- I have the following code that deletes a certain cell... Cells(i1, "N").Delete Shift:=xlShiftUp I would like it to also delete the next 4 cells to the right using the same delete method? I would assume I would have to use an offset method. Can anyone please tell me how to do this? Thank you Todd Huttenstine . |
Offset Code
Todd,
Tested it and it worked fine for me. Dave posted the same method that I did. He also gave you another choice which should also work. If neither of them work for you, then there's something that you're not telling us. John "Todd Huttenstine" wrote in message ... That did not work. -----Original Message----- Todd, Try: Cells(i1, "N").Resize(,4).Delete Shift:=xlShiftUp John "Todd Huttenstine" wrote in message ... I have the following code that deletes a certain cell... Cells(i1, "N").Delete Shift:=xlShiftUp I would like it to also delete the next 4 cells to the right using the same delete method? I would assume I would have to use an offset method. Can anyone please tell me how to do this? Thank you Todd Huttenstine . |
Offset Code
Did it not work because both John and I can't count to 4?
When I tested, it worked very similar to your code. And it was exact if the .resize(1,4) was changed to .resize(1,5). Todd Huttenstine wrote: That did not work. -----Original Message----- Todd, Try: Cells(i1, "N").Resize(,4).Delete Shift:=xlShiftUp John "Todd Huttenstine" wrote in message ... I have the following code that deletes a certain cell... Cells(i1, "N").Delete Shift:=xlShiftUp I would like it to also delete the next 4 cells to the right using the same delete method? I would assume I would have to use an offset method. Can anyone please tell me how to do this? Thank you Todd Huttenstine . -- Dave Peterson |
Offset Code
I got it to work. thanx. For some reason I forgot to add
my shift code. Thanx to both. -----Original Message----- Todd, Tested it and it worked fine for me. Dave posted the same method that I did. He also gave you another choice which should also work. If neither of them work for you, then there's something that you're not telling us. John "Todd Huttenstine" wrote in message ... That did not work. -----Original Message----- Todd, Try: Cells(i1, "N").Resize(,4).Delete Shift:=xlShiftUp John "Todd Huttenstine" wrote in message ... I have the following code that deletes a certain cell... Cells(i1, "N").Delete Shift:=xlShiftUp I would like it to also delete the next 4 cells to the right using the same delete method? I would assume I would have to use an offset method. Can anyone please tell me how to do this? Thank you Todd Huttenstine . . |
All times are GMT +1. The time now is 12:35 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com