ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using a command button to insert a new row. (https://www.excelbanter.com/excel-programming/286423-using-command-button-insert-new-row.html)

Jared[_2_]

Using a command button to insert a new row.
 
Hello,

I have two questions, (I have no problem getting around Excel but this
is my first time tackleing the dynamic side of it)

First what I want to do is:

Use a command button to insert a row, two rows above the command
button. I have a worksheet that has many cells that need to be filled
in by the end user that need to be produced.

Second is:

Once I finish, what do I need to do to hide all my formulas and stuff,
so that nothing gets messed up by the user.

Thanks

Dave Peterson[_3_]

Using a command button to insert a new row.
 
#1. A commandbutton from the Control Toolbox toolbar????

Option Explicit
Private Sub CommandButton1_Click()
Me.CommandButton1.TopLeftCell.Offset(-2, 0).EntireRow.Insert
End Sub


#2. Cells can be locked or unlocked. (Format|cells|Protection tab)
And when you're on that tab, you can see an option to hide the formula
in a locked cell. (just check both boxes)

But then you have to protect the sheet. Tools|Protection|Protect sheet

Be aware that this protection isn't very strong. There's code posted here every
week that will allow the curious to see your stuff.



Jared wrote:

Hello,

I have two questions, (I have no problem getting around Excel but this
is my first time tackleing the dynamic side of it)

First what I want to do is:

Use a command button to insert a row, two rows above the command
button. I have a worksheet that has many cells that need to be filled
in by the end user that need to be produced.

Second is:

Once I finish, what do I need to do to hide all my formulas and stuff,
so that nothing gets messed up by the user.

Thanks


--

Dave Peterson



All times are GMT +1. The time now is 01:41 PM.

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