[program-l] Re: Microsoft Excel 2003: running a macro on row insertion

  • From: David Lant <david.lant@xxxxxxxxxxxx>
  • To: "'program-l@xxxxxxxxxxxxx'" <program-l@xxxxxxxxxxxxx>
  • Date: Tue, 13 Sep 2005 10:25:46 +0100

Hi Pranav,

Although I don't have Excel 2003, I don't think its object model is
enormously different from that of Excel 2002.  I don't believe that a row is
a defined object in Excel.  A row is simply a special case of a Range
object.   Thus, the lack of an event based on rows isn't surprising.

There is a SheetChanged event, which is triggered any time a change is made
to the current worksheet.  One of the parameters returns the range object
representing the change to the sheet.  So, if you have any means by which
you could tell whether the change to the sheet amounted to the addition of a
row, then this event would be the place to do it.

David Lant

I.T. Consultant 
Consultancy & Development
ICT Services
Tel: (01392) 382464

Devon County Council accepts no legal responsibility for the contents of
this message. The views expressed do not reflect those of Devon County
Council.


-----Original Message-----
From: Pranav Lal [mailto:pranav.lal@xxxxxxxxxxxxxxxxx] 
Sent: 13 September 2005 01:05
To: program-l@xxxxxxxxxxxxx
Subject: [program-l] Re: Microsoft Excel 2003: running a macro on row
insertion


Hi George,

I do not want to have the user click any buttons etc since the user 
may forget to do so before sending the time sheet. If the user 
inserts a row, the macro should run.

Pranav
on Monday 9/12/2005 10:34 PM, George Bell said:
Hi Pranav,

If I know what the Macro Command was for up arrow, I'd say
yes.  However, I can't seem to get away from a specific co-ordinate.

What I wanted to do, was search for a string, then insert a
row above.  This would then be assigned to a button which,
when clicked on, would insert a row above it.

Sub Insert_Row()
'
' Insert_Row Macro
' Macro recorded 12/09/2005 by George Bell
'
' Keyboard Shortcut: Ctrl+i
'
     Rows("4:4").Select
     Selection.Insert Shift:=xlUp
End Sub

George.

 > -----Original Message-----
 > From: program-l-bounce@xxxxxxxxxxxxx
 > [mailto:program-l-bounce@xxxxxxxxxxxxx] On Behalf Of
Pranav Lal
 > Sent: 12 September 2005 16:33
 > To: program-l-freelists.org
 > Subject: [program-l] Microsoft Excel 2003: running a macro on  > row
insertion  >  > Hi all,  >  > Is it possible to run a macro when a user
inserts a row in a  > worksheet? I took a look at the list of events and was
unable  > to find any suitable event.  >  > I need this capability in my
time sheet Excel sheet. Some  > users work on multiple projects in a day so
need to add  > additional rows. The problem is that there are certain hidden
> columns like activity code, project code etc. They need to

 > copy a formula from the previous row into the newly
inserted
 > row. They forget to do this.
 >
 > Pranav
 >
------------------------------------------------------------
--
 >
------------------------------------------------------------
--
 > -----------
 > Pranav
 >
 > ** To leave the list, click on the immediately-following
link:-
 > ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
 > ** If this link doesn't work then send a message to:
 > ** program-l-request@xxxxxxxxxxxxx
 > ** and in the Subject line type
 > ** unsubscribe
 > ** For other list commands such as vacation mode, click on the  > **
immediately-following link:-  > **
[mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
 > ** or send a message, to
 > ** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
 >
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
----------------------------------------------------------------------------
-----------------------------------------------------------
Pranav

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: