Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default delete rows w/o hardcoding numbers

I'd like to delete a group of rows. Normally I would do:

Rows("12:45").Delete Shift:=xlUp

But the row numbers are stored in variables. I can't do (causes an
error):

Rows("intBeginDelete:intEndDelete").Delete Shift:=xlUp

I can do it using a For...Next loop, deleting the rows one at a time,
but I'm working with lots of row groups & files and that makes
execution slow. Is there an easier/faster way to do this?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default delete rows w/o hardcoding numbers

Rows(intBeginDelete & ":" & intEndDelete).Delete

might work ok.


Dave B wrote:

I'd like to delete a group of rows. Normally I would do:

Rows("12:45").Delete Shift:=xlUp

But the row numbers are stored in variables. I can't do (causes an
error):

Rows("intBeginDelete:intEndDelete").Delete Shift:=xlUp

I can do it using a For...Next loop, deleting the rows one at a time,
but I'm working with lots of row groups & files and that makes
execution slow. Is there an easier/faster way to do this?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default delete rows w/o hardcoding numbers

Thanks for the suggestion. It gives me a Type Mismatch error. Any
idea why?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default delete rows w/o hardcoding numbers

I'd guess that one (maybe both) your variables aren't what you expect:


Dave B wrote:

Thanks for the suggestion. It gives me a Type Mismatch error. Any
idea why?


--

Dave Peterson
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 rows between tow inputs numbers Colin Hayes Excel Discussion (Misc queries) 3 December 28th 11 11:29 PM
locate positive numbers and delete rows containing Giggly4g Excel Discussion (Misc queries) 3 April 2nd 08 03:47 AM
Selecting worksheets without hardcoding Bob Phillips[_6_] Excel Programming 1 May 4th 04 09:01 PM
Selecting worksheets without hardcoding jeff Excel Programming 0 May 4th 04 08:45 PM
delete rows without numbers mudraker[_28_] Excel Programming 0 November 20th 03 12:00 AM


All times are GMT +1. The time now is 11:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"