Samantha has attended:
Excel VBA Intro Intermediate course
Inserting a new row in a particular place
I have a password protected spreadsheets that users input data into. The data area has a number of rows and then a protected row at the bottom which has formulae in to tal the above data.
I'd like to write a code so that the user of a spreadsheet can insert a new row by clicking a button and it adds the row at the bottom of the data area but above the total row and also updates the total row formulae to include the new row!
Does this sound possible ad any pointers on where to start?
RE: Inserting a new row in a particular place
Hi Samantha
Thanks for your question
You can insert a row at the bottom of your data with the following
code
Dim intLastRow
intLastRow = sheets(1).Range("A1").CurrentRegion.Rows.Count
Sheets(1).Rows(intLastRow).Insert
This imply calculates the last row number and inserts a row there. If the last row contains formulae, then they will update automatically
Regards
Stephen