Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Selecting rows

I am having trouble selecting rows in a macro and deleting
them.

I know you normally would write:
Rows("a1:a3").select
Selection.Delete Shift:=xlUp

problem I am having is the rows are vaiables..

I have wrote code to pick up a set a start & end row as
dim startrow and dim endrow

How do I the select that range ???

I tried Rows(startrow:endrow).select but no joy ???

Help me please...

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Selecting rows

Normally it would be

Rows(1:3).Delete Shift:=xlup


so you could do

j = 3
k = 20
Rows(j & ":" & k).Delete shift:=xlup

--
Regards,
Tom Ogilvy


"Walshy"

g.uk wrote in message ...
I am having trouble selecting rows in a macro and deleting
them.

I know you normally would write:
Rows("a1:a3").select
Selection.Delete Shift:=xlUp

problem I am having is the rows are vaiables..

I have wrote code to pick up a set a start & end row as
dim startrow and dim endrow

How do I the select that range ???

I tried Rows(startrow:endrow).select but no joy ???

Help me please...

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Selecting rows

Thanks loads this is great !!!

-----Original Message-----
Normally it would be

Rows(1:3).Delete Shift:=xlup


so you could do

j = 3
k = 20
Rows(j & ":" & k).Delete shift:=xlup

--
Regards,
Tom Ogilvy


"Walshy"

g.uk wrote in message news:156501c49b24$0df95af0

...
I am having trouble selecting rows in a macro and

deleting
them.

I know you normally would write:
Rows("a1:a3").select
Selection.Delete Shift:=xlUp

problem I am having is the rows are vaiables..

I have wrote code to pick up a set a start & end row as
dim startrow and dim endrow

How do I the select that range ???

I tried Rows(startrow:endrow).select but no joy ???

Help me please...

Thanks



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Selecting rows

hi.
what is the rest of your code that ids the start row and
end row??

-----Original Message-----
I am having trouble selecting rows in a macro and

deleting
them.

I know you normally would write:
Rows("a1:a3").select
Selection.Delete Shift:=xlUp

problem I am having is the rows are vaiables..

I have wrote code to pick up a set a start & end row as
dim startrow and dim endrow

How do I the select that range ???

I tried Rows(startrow:endrow).select but no joy ???

Help me please...

Thanks
.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Selecting rows

Rows(1:3).Delete Shift:=xlup

should have been

Rows("1:3").Delete Shift:=xlup

but the approach with variables is fine.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
Normally it would be

Rows(1:3).Delete Shift:=xlup


so you could do

j = 3
k = 20
Rows(j & ":" & k).Delete shift:=xlup

--
Regards,
Tom Ogilvy


"Walshy"

g.uk wrote in message ...
I am having trouble selecting rows in a macro and deleting
them.

I know you normally would write:
Rows("a1:a3").select
Selection.Delete Shift:=xlUp

problem I am having is the rows are vaiables..

I have wrote code to pick up a set a start & end row as
dim startrow and dim endrow

How do I the select that range ???

I tried Rows(startrow:endrow).select but no joy ???

Help me please...

Thanks







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Selecting rows

Just personal preference is to avoid using strings. Here is just one
additional idea.

Dim s, e 'start & end rows to delete
s = 5
e = 10
Rows(s).Resize(e - s + 1).Delete

Note that Excel assumes Shift:=xlUp when it is the entire row.

HTH
Dana DeLouis

"Walshy" wrote in message
...
I am having trouble selecting rows in a macro and deleting
them.

I know you normally would write:
Rows("a1:a3").select
Selection.Delete Shift:=xlUp

problem I am having is the rows are vaiables..

I have wrote code to pick up a set a start & end row as
dim startrow and dim endrow

How do I the select that range ???

I tried Rows(startrow:endrow).select but no joy ???

Help me please...

Thanks



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
Selecting All Rows with Certain Data Ron Coderre Excel Discussion (Misc queries) 0 November 29th 06 07:44 PM
after selecting 50 rows of a column i can't reference the cells in the rows Bob Salzer New Users to Excel 2 July 21st 06 10:29 PM
Selecting Rows Coolboy55 Excel Worksheet Functions 4 August 22nd 05 04:07 PM
Selecting Rows Alan Excel Programming 4 October 16th 03 09:10 PM
selecting rows CiaraG Excel Programming 0 August 8th 03 10:07 AM


All times are GMT +1. The time now is 03:38 PM.

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"