Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Offset Code
How about .resize:
cells(il,"n").resize(1,4).delete shift:=xlshiftup or not quite as pretty: range(cells(il,"N"),cells(il,"n").offset(0,3)).del ete shift:=xlshiftup Todd Huttenstine wrote: 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 . |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 . |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Code to conditional format all black after date specified in code? | Excel Discussion (Misc queries) | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul | Excel Worksheet Functions | |||
Offset code for dynamic row# & multiple columns in LINEST function | Excel Worksheet Functions |