ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   InsertRowsAndFillFormulas (https://www.excelbanter.com/excel-programming/297391-re-insertrowsandfillformulas.html)

david mcritchie

InsertRowsAndFillFormulas
 
Hi Leslie,
I presume you mean the macro from my web page, just so everyone
knows what you are talking about.
http://www.mvps.org/dmcritchie/excel/insrtrow.htm

comment out the following code

vRows = Application.InputBox(prompt:= _
"How many rows do you want to add?", Title:="Add Rows", _
Default:=1, Type:=1) 'type 1 is number
If vRows = False Then Exit Sub

as follows:

vRows = 1
'-- vRows = Application.InputBox(prompt:= _
' -- "How many rows do you want to add?", Title:="Add Rows", _
' -- Default:=1, Type:=1) 'type 1 is number
'-- If vRows = False Then Exit Sub


The macro can be used as modiifed to insert 1 row, but still retain
the option to insert a specified number of rows if the optional
paramter is used when called from another macro.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Leslie" wrote in message ...
I've placed this macro in my worksheet and it works, but I don't want the user to have the option of how many rows to enter. Each

time it is opened it should insert a row. I've not written macros before, but I did try a few things to see if I could make it do
that. I was not successful. I'd appreciate any help you can give me.

Thanks

Leslie




Leslie

InsertRowsAndFillFormulas
 

Thanks, David. Yes, I did mean your macro from your web page. I could swear that was one of the things I tried yesterday that didn't work, but I guess not because when I did it today it worked. Anyway, here's the thing. I have the macro in a Worksheet_Activate() paragraph. So now what happens is....it inserts a new row if I click to sheet2 and then back to sheet1, but not when I open the worksheet. Any suggestions
----- David McRitchie wrote: ----

Hi Leslie
I presume you mean the macro from my web page, just so everyon
knows what you are talking about
http://www.mvps.org/dmcritchie/excel/insrtrow.ht

comment out the following cod

vRows = Application.InputBox(prompt:=
"How many rows do you want to add?", Title:="Add Rows",
Default:=1, Type:=1) 'type 1 is numbe
If vRows = False Then Exit Su

as follows

vRows =
'-- vRows = Application.InputBox(prompt:=
' -- "How many rows do you want to add?", Title:="Add Rows",
' -- Default:=1, Type:=1) 'type 1 is numbe
'-- If vRows = False Then Exit Su


The macro can be used as modiifed to insert 1 row, but still retai
the option to insert a specified number of rows if the optiona
paramter is used when called from another macro
--
HTH
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.ht
Search Page: http://www.mvps.org/dmcritchie/excel/search.ht

"Leslie" wrote in message ..
I've placed this macro in my worksheet and it works, but I don't want the user to have the option of how many rows to enter. Eac

time it is opened it should insert a row. I've not written macros before, but I did try a few things to see if I could make it d
that. I was not successful. I'd appreciate any help you can give me
Thank
Lesli





Leslie

InsertRowsAndFillFormulas
 

One more thing. If, when the worksheet is opened, there is a row that has not been filled in, I don't want it to insert a new row. I don't want this worksheet to ever be bigger than it needs to be. I'm envisioning a situration where a user opens the worksheet to add something and then is interrupted. They would close the worksheet and come back to it later. When they opened the worksheet again, a new row would be inserted. Since there will probably be eight or ten users with access to this worksheet, the likelihood of this happening is pretty good
----- Leslie wrote: ----


Thanks, David. Yes, I did mean your macro from your web page. I could swear that was one of the things I tried yesterday that didn't work, but I guess not because when I did it today it worked. Anyway, here's the thing. I have the macro in a Worksheet_Activate() paragraph. So now what happens is....it inserts a new row if I click to sheet2 and then back to sheet1, but not when I open the worksheet. Any suggestions
----- David McRitchie wrote: ----

Hi Leslie
I presume you mean the macro from my web page, just so everyon
knows what you are talking about
http://www.mvps.org/dmcritchie/excel/insrtrow.ht

comment out the following cod

vRows = Application.InputBox(prompt:=
"How many rows do you want to add?", Title:="Add Rows",
Default:=1, Type:=1) 'type 1 is numbe
If vRows = False Then Exit Su

as follows

vRows =
'-- vRows = Application.InputBox(prompt:=
' -- "How many rows do you want to add?", Title:="Add Rows",
' -- Default:=1, Type:=1) 'type 1 is numbe
'-- If vRows = False Then Exit Su


The macro can be used as modiifed to insert 1 row, but still retai
the option to insert a specified number of rows if the optiona
paramter is used when called from another macro
--
HTH
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.ht
Search Page: http://www.mvps.org/dmcritchie/excel/search.ht

"Leslie" wrote in message ..
I've placed this macro in my worksheet and it works, but I don't want the user to have the option of how many rows to enter. Eac

time it is opened it should insert a row. I've not written macros before, but I did try a few things to see if I could make it d
that. I was not successful. I'd appreciate any help you can give me
Thank
Lesli






All times are GMT +1. The time now is 01:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com