SlinkRN
Well-known Member
- Joined
- Oct 29, 2002
- Messages
- 715
This seems like it would be so easy but I just can't get it to work yet. I need to do this:
sheets("sheet1").range("4:136,158:198,250:289,316:800").select
selection.delete shift:=xlup
EXCEPT that I need to use variables to find the row numbers.
Row 4 is always row 4 so I can use that number.
Row 136 will actually be the variable DeleteRow
Row 158 will actually be the variables DeleteRow + EndDeleteRow
Row 198 will actually be the variable DeleteRow2
Row 250 will actually be the variables DeleteRow2 + EndDeleteRow2
Row 289 will actually be the variable DeleteRow3
Row 316 will actually be the variables DeleteRow3 + EndDeleteRow3
Row 800 is always row 800 so I can use that number.
I've tried:
sheets("sheet1").range("4:" & DeleteRow,DeleteRow + EndDeleteRow & ":" & DeleteRow2,DeleteRow2 + EndDeleteRow2 & ":" & DeleteRow3,DeleteRow3 + EndDeleteRow3 & ":800").select
selection.delete shift:=xlup
but I get an error saying "Run-time error '450' Wrong number of arguments or invalid property assignment"
What am I missing? Thanks so much! Slink
sheets("sheet1").range("4:136,158:198,250:289,316:800").select
selection.delete shift:=xlup
EXCEPT that I need to use variables to find the row numbers.
Row 4 is always row 4 so I can use that number.
Row 136 will actually be the variable DeleteRow
Row 158 will actually be the variables DeleteRow + EndDeleteRow
Row 198 will actually be the variable DeleteRow2
Row 250 will actually be the variables DeleteRow2 + EndDeleteRow2
Row 289 will actually be the variable DeleteRow3
Row 316 will actually be the variables DeleteRow3 + EndDeleteRow3
Row 800 is always row 800 so I can use that number.
I've tried:
sheets("sheet1").range("4:" & DeleteRow,DeleteRow + EndDeleteRow & ":" & DeleteRow2,DeleteRow2 + EndDeleteRow2 & ":" & DeleteRow3,DeleteRow3 + EndDeleteRow3 & ":800").select
selection.delete shift:=xlup
but I get an error saying "Run-time error '450' Wrong number of arguments or invalid property assignment"
What am I missing? Thanks so much! Slink