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

Hello,

I want to write a macro where on inserting a new row in the active
worksheet, the newly inserted row will become yellow in color. But I dont
know how to do this. kindly help

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Insert macro

Selection.EntireRow.Insert
ActiveCell.EntireRow.Interior.ColorIndex = 6

Regards,
Stefi

€˛Subhojeet€¯ ezt Ć*rta:

Hello,

I want to write a macro where on inserting a new row in the active
worksheet, the newly inserted row will become yellow in color. But I dont
know how to do this. kindly help

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Insert macro

Thanks for the reply but to use the below mentioned code I need to write a
sub routine. But I want this to happen the moment someone inserts a new row,
maybe by right clicking on the worksheet and select "Insert" from the pop up
menu. I guess I need to capture the Insert event. How do I do that?
Thanks

"Stefi" wrote:

Selection.EntireRow.Insert
ActiveCell.EntireRow.Interior.ColorIndex = 6

Regards,
Stefi

€˛Subhojeet€¯ ezt Ć*rta:

Hello,

I want to write a macro where on inserting a new row in the active
worksheet, the newly inserted row will become yellow in color. But I dont
know how to do this. kindly help

Thanks


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Insert macro

Unfortunately there is no Insert event. As far as I know the only event
triggered by inserting a row is Calculate event, but if you want to
distinguish between row inserting and other events also triggering Calculate
event you have to apply other programming tricks, e.g. maintain a global
variable (say NoOfRows) storing No of rows and compare it to actual No of
rows in Calculate event sub. If actual No of rows is greater then NoOfRows
then add 1 to NoOfRows and do what you need in case of inserting. This is
only an idea, you have to try wether it works or not.

Perhaps real XL gurus know a better way!?

Regards,
Stefi


"Subhojeet" wrote:

Thanks for the reply but to use the below mentioned code I need to write a
sub routine. But I want this to happen the moment someone inserts a new row,
maybe by right clicking on the worksheet and select "Insert" from the pop up
menu. I guess I need to capture the Insert event. How do I do that?
Thanks

"Stefi" wrote:

Selection.EntireRow.Insert
ActiveCell.EntireRow.Interior.ColorIndex = 6

Regards,
Stefi

€˛Subhojeet€¯ ezt Ć*rta:

Hello,

I want to write a macro where on inserting a new row in the active
worksheet, the newly inserted row will become yellow in color. But I dont
know how to do this. kindly help

Thanks


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Insert macro

Hi
I have written the following code in module 1 to capture calculate event.
But this is not working

Private Sub Calculate()
Dim rngCurrent As Range
Set rngCurrent = ActiveCell

ActiveSheet.Rows(rngCurrent.Row & ":" &
rngCurrent.Row).Interior.ColorIndex = 6


End Sub

Please tell me what to do next. I am great turmoil.
Thanks

"Stefi" wrote:

Unfortunately there is no Insert event. As far as I know the only event
triggered by inserting a row is Calculate event, but if you want to
distinguish between row inserting and other events also triggering Calculate
event you have to apply other programming tricks, e.g. maintain a global
variable (say NoOfRows) storing No of rows and compare it to actual No of
rows in Calculate event sub. If actual No of rows is greater then NoOfRows
then add 1 to NoOfRows and do what you need in case of inserting. This is
only an idea, you have to try wether it works or not.

Perhaps real XL gurus know a better way!?

Regards,
Stefi


"Subhojeet" wrote:

Thanks for the reply but to use the below mentioned code I need to write a
sub routine. But I want this to happen the moment someone inserts a new row,
maybe by right clicking on the worksheet and select "Insert" from the pop up
menu. I guess I need to capture the Insert event. How do I do that?
Thanks

"Stefi" wrote:

Selection.EntireRow.Insert
ActiveCell.EntireRow.Interior.ColorIndex = 6

Regards,
Stefi

€˛Subhojeet€¯ ezt Ć*rta:

Hello,

I want to write a macro where on inserting a new row in the active
worksheet, the newly inserted row will become yellow in color. But I dont
know how to do this. kindly help

Thanks




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Insert macro

Calculate event shouldn't be placed in a normal module!

In VBA Prpject Explorer right click on sheet name you want to apply
Calculate event on! from the local menu choose View code! From Objects (left
dropdown list) choose Worksheet! From Procedures (right dropdown list) choose
Calculate!

Regards,
Stefi

€˛Subhojeet€¯ ezt Ć*rta:

Hi
I have written the following code in module 1 to capture calculate event.
But this is not working

Private Sub Calculate()
Dim rngCurrent As Range
Set rngCurrent = ActiveCell

ActiveSheet.Rows(rngCurrent.Row & ":" &
rngCurrent.Row).Interior.ColorIndex = 6


End Sub

Please tell me what to do next. I am great turmoil.
Thanks

"Stefi" wrote:

Unfortunately there is no Insert event. As far as I know the only event
triggered by inserting a row is Calculate event, but if you want to
distinguish between row inserting and other events also triggering Calculate
event you have to apply other programming tricks, e.g. maintain a global
variable (say NoOfRows) storing No of rows and compare it to actual No of
rows in Calculate event sub. If actual No of rows is greater then NoOfRows
then add 1 to NoOfRows and do what you need in case of inserting. This is
only an idea, you have to try wether it works or not.

Perhaps real XL gurus know a better way!?

Regards,
Stefi


"Subhojeet" wrote:

Thanks for the reply but to use the below mentioned code I need to write a
sub routine. But I want this to happen the moment someone inserts a new row,
maybe by right clicking on the worksheet and select "Insert" from the pop up
menu. I guess I need to capture the Insert event. How do I do that?
Thanks

"Stefi" wrote:

Selection.EntireRow.Insert
ActiveCell.EntireRow.Interior.ColorIndex = 6

Regards,
Stefi

€˛Subhojeet€¯ ezt Ć*rta:

Hello,

I want to write a macro where on inserting a new row in the active
worksheet, the newly inserted row will become yellow in color. But I dont
know how to do this. kindly help

Thanks


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Insert macro

Thanks for the reply. I did the same. I wrote the code as mentioned below in
the conversation. But when I am inserting a new row in the worksheet, it is
not making it yellow in color.

Please help.

"Stefi" wrote:

Calculate event shouldn't be placed in a normal module!

In VBA Prpject Explorer right click on sheet name you want to apply
Calculate event on! from the local menu choose View code! From Objects (left
dropdown list) choose Worksheet! From Procedures (right dropdown list) choose
Calculate!

Regards,
Stefi

€˛Subhojeet€¯ ezt Ć*rta:

Hi
I have written the following code in module 1 to capture calculate event.
But this is not working

Private Sub Calculate()
Dim rngCurrent As Range
Set rngCurrent = ActiveCell

ActiveSheet.Rows(rngCurrent.Row & ":" &
rngCurrent.Row).Interior.ColorIndex = 6


End Sub

Please tell me what to do next. I am great turmoil.
Thanks

"Stefi" wrote:

Unfortunately there is no Insert event. As far as I know the only event
triggered by inserting a row is Calculate event, but if you want to
distinguish between row inserting and other events also triggering Calculate
event you have to apply other programming tricks, e.g. maintain a global
variable (say NoOfRows) storing No of rows and compare it to actual No of
rows in Calculate event sub. If actual No of rows is greater then NoOfRows
then add 1 to NoOfRows and do what you need in case of inserting. This is
only an idea, you have to try wether it works or not.

Perhaps real XL gurus know a better way!?

Regards,
Stefi


"Subhojeet" wrote:

Thanks for the reply but to use the below mentioned code I need to write a
sub routine. But I want this to happen the moment someone inserts a new row,
maybe by right clicking on the worksheet and select "Insert" from the pop up
menu. I guess I need to capture the Insert event. How do I do that?
Thanks

"Stefi" wrote:

Selection.EntireRow.Insert
ActiveCell.EntireRow.Interior.ColorIndex = 6

Regards,
Stefi

€˛Subhojeet€¯ ezt Ć*rta:

Hello,

I want to write a macro where on inserting a new row in the active
worksheet, the newly inserted row will become yellow in color. But I dont
know how to do this. kindly help

Thanks


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Insert macro

Post your code!
Stefi


€˛Subhojeet€¯ ezt Ć*rta:

Thanks for the reply. I did the same. I wrote the code as mentioned below in
the conversation. But when I am inserting a new row in the worksheet, it is
not making it yellow in color.

Please help.

"Stefi" wrote:

Calculate event shouldn't be placed in a normal module!

In VBA Prpject Explorer right click on sheet name you want to apply
Calculate event on! from the local menu choose View code! From Objects (left
dropdown list) choose Worksheet! From Procedures (right dropdown list) choose
Calculate!

Regards,
Stefi

€˛Subhojeet€¯ ezt Ć*rta:

Hi
I have written the following code in module 1 to capture calculate event.
But this is not working

Private Sub Calculate()
Dim rngCurrent As Range
Set rngCurrent = ActiveCell

ActiveSheet.Rows(rngCurrent.Row & ":" &
rngCurrent.Row).Interior.ColorIndex = 6


End Sub

Please tell me what to do next. I am great turmoil.
Thanks

"Stefi" wrote:

Unfortunately there is no Insert event. As far as I know the only event
triggered by inserting a row is Calculate event, but if you want to
distinguish between row inserting and other events also triggering Calculate
event you have to apply other programming tricks, e.g. maintain a global
variable (say NoOfRows) storing No of rows and compare it to actual No of
rows in Calculate event sub. If actual No of rows is greater then NoOfRows
then add 1 to NoOfRows and do what you need in case of inserting. This is
only an idea, you have to try wether it works or not.

Perhaps real XL gurus know a better way!?

Regards,
Stefi


"Subhojeet" wrote:

Thanks for the reply but to use the below mentioned code I need to write a
sub routine. But I want this to happen the moment someone inserts a new row,
maybe by right clicking on the worksheet and select "Insert" from the pop up
menu. I guess I need to capture the Insert event. How do I do that?
Thanks

"Stefi" wrote:

Selection.EntireRow.Insert
ActiveCell.EntireRow.Interior.ColorIndex = 6

Regards,
Stefi

€˛Subhojeet€¯ ezt Ć*rta:

Hello,

I want to write a macro where on inserting a new row in the active
worksheet, the newly inserted row will become yellow in color. But I dont
know how to do this. kindly help

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
Macro to Insert Current Date into cell - Macro to "Save As" Guy[_2_] Excel Worksheet Functions 4 December 12th 08 08:20 PM
make a macro to insert a macro mithu Excel Discussion (Misc queries) 6 March 20th 07 06:04 PM
Macro to insert copy and insert formulas only to next blank row bob Excel Programming 0 June 30th 06 12:02 PM
Insert Row Macro Help ksp Excel Programming 2 January 16th 06 09:39 AM
Macro to insert row. Steve[_71_] Excel Programming 15 August 3rd 05 02:12 AM


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