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

I have a macro which deletes a set of rows, but once the delete is done, I
need the curser to shift right by i cell. Problem is when you delete rows you
do not have just one active cell selected.

2. is there any way to ensure the macro does not run if an entire row (or
rows) is not selectee ?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Deleting rows

On Apr 15, 4:10*am, ordnance1
wrote:
I have a macro which deletes a set of rows, but once the delete is done, I
need the curser to shift right by i cell. Problem is when you delete rows you
do not have just one active cell selected.

2. is there any way to ensure the macro does not run if an entire row (or
rows) is not selectee ?


Hello,

The problem is not very clear from your post. Could you please post
the code also?

Regards
Anant
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Deleting rows

You don't need to select rows to delete them.

ActiveSheet.Range("A1:A56").EntireRow.Delete

Post your code for more assistance.

Easy enough to offset from the activecell if we knew where you wanted it.


Gord Dibben MS Excel MVP

On Mon, 14 Apr 2008 16:10:01 -0700, ordnance1
wrote:

I have a macro which deletes a set of rows, but once the delete is done, I
need the curser to shift right by i cell. Problem is when you delete rows you
do not have just one active cell selected.

2. is there any way to ensure the macro does not run if an entire row (or
rows) is not selectee ?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Deleting rows

I assume you want it one cell to the right of where you currently see it when
the macro is finished. If that is the case then insert this line just before
the End Sub.

ActiveCell.Offset(0, 1).Select

That will move the cursor one cell to the right of the active cell. If this
is not what you need then do as Anant suggested and post the macro you are
using so we can see where the cursor action is.

"ordnance1" wrote:

I have a macro which deletes a set of rows, but once the delete is done, I
need the curser to shift right by i cell. Problem is when you delete rows you
do not have just one active cell selected.

2. is there any way to ensure the macro does not run if an entire row (or
rows) is not selectee ?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Deleting rows

Thanks for the reply.

The user will have to select the rows since they will not always be the me.
So my problem is that when you select a set of rows to delete, once they are
deleted you end up with a like number of rows still selected. So if you
select rows 5,6 and 7 for deletion, once they are deleted rows 5, 6 and 7 are
still selected soif you use ActiveCell.Offset(0, 1).Select you get an error
because there is no active cell selected.

"JLGWhiz" wrote:

I assume you want it one cell to the right of where you currently see it when
the macro is finished. If that is the case then insert this line just before
the End Sub.

ActiveCell.Offset(0, 1).Select

That will move the cursor one cell to the right of the active cell. If this
is not what you need then do as Anant suggested and post the macro you are
using so we can see where the cursor action is.

"ordnance1" wrote:

I have a macro which deletes a set of rows, but once the delete is done, I
need the curser to shift right by i cell. Problem is when you delete rows you
do not have just one active cell selected.

2. is there any way to ensure the macro does not run if an entire row (or
rows) is not selectee ?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Deleting rows

Selection.Delete Shift:=xlUp

The user will have to select the rows since they will not always be the me.
So my problem is that when you select a set of rows to delete, once they are
deleted you end up with a like number of rows still selected. So if you
select rows 5,6 and 7 for deletion, once they are deleted rows 5, 6 and 7 are
still selected soif you use ActiveCell.Offset(0, 1).Select you get an error
because there is no active cell selected.





"Gord Dibben" wrote:

You don't need to select rows to delete them.

ActiveSheet.Range("A1:A56").EntireRow.Delete

Post your code for more assistance.

Easy enough to offset from the activecell if we knew where you wanted it.


Gord Dibben MS Excel MVP

On Mon, 14 Apr 2008 16:10:01 -0700, ordnance1
wrote:

I have a macro which deletes a set of rows, but once the delete is done, I
need the curser to shift right by i cell. Problem is when you delete rows you
do not have just one active cell selected.

2. is there any way to ensure the macro does not run if an entire row (or
rows) is not selectee ?



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Deleting rows

There has to be an active cell no matter if you have 20 rows selected.

Active cell will be top left cell in selection.

i.e. select row headers 1:15. You will see that A1 is the active cell

EditDeleteEntire Row

A1 is still the active cell.

ActiveCell.Offset(0, 1) is B1

Select G1:K23 and EditDeleteEntire Row

G1 will be the active cell.


Gord


On Mon, 14 Apr 2008 17:14:01 -0700, ordnance1
wrote:

Selection.Delete Shift:=xlUp

The user will have to select the rows since they will not always be the me.
So my problem is that when you select a set of rows to delete, once they are
deleted you end up with a like number of rows still selected. So if you
select rows 5,6 and 7 for deletion, once they are deleted rows 5, 6 and 7 are
still selected soif you use ActiveCell.Offset(0, 1).Select you get an error
because there is no active cell selected.





"Gord Dibben" wrote:

You don't need to select rows to delete them.

ActiveSheet.Range("A1:A56").EntireRow.Delete

Post your code for more assistance.

Easy enough to offset from the activecell if we knew where you wanted it.


Gord Dibben MS Excel MVP

On Mon, 14 Apr 2008 16:10:01 -0700, ordnance1
wrote:

I have a macro which deletes a set of rows, but once the delete is done, I
need the curser to shift right by i cell. Problem is when you delete rows you
do not have just one active cell selected.

2. is there any way to ensure the macro does not run if an entire row (or
rows) is not selectee ?




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
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Links and Linking in Excel 1 November 13th 08 08:44 AM
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Setting up and Configuration of Excel 1 November 12th 08 06:05 PM
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Excel Worksheet Functions 1 November 12th 08 01:39 PM
Help!! I have problem deleting 2500 rows of filtered rows!!!! shirley_kee Excel Discussion (Misc queries) 1 January 12th 06 03:24 AM
deleting hidden rows so i can print only the rows showing?????? jenn Excel Worksheet Functions 0 October 6th 05 04:05 PM


All times are GMT +1. The time now is 09:05 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"