Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to Insert Current Date into cell - Macro to "Save As" | Excel Worksheet Functions | |||
make a macro to insert a macro | Excel Discussion (Misc queries) | |||
Macro to insert copy and insert formulas only to next blank row | Excel Programming | |||
Insert Row Macro Help | Excel Programming | |||
Macro to insert row. | Excel Programming |