I am using the given macro to add 10 rows at the end of the database "Main1DB
I have also attached the sample file.
Application.ScreenUpdating = False
Selection.AutoFill Destination:=Range("Main3DBAdd5"), Type:=xlFillDefault
Application.ScreenUpdating = True
What I wish is that as soon as the Main1DBBlank
value is Less than 21, the macro automatically triggers and adds 20 rows at the end.
E.g., What I require is that as soon as some value is filled in cell B10, blank rows in the database will be reduced to 20 and so that will act as a macro triggering event which will
--Unprotect the sheet using Password "Password"
--Clear the Filters, if any
--Add 20 rows at the bottom of the range "BiltyDB"
--enter the serial number in Column A
--Turn the Auto Filters ON
--Protect the sheet using Password "Password" with the following persmissions
---Select Unlocked Cells - Allowed
---Format Columns - Allowed
---Use Auto Filter - Allowed
---Edit Objects - Allowed
--Cursor returns to its previous position where it was before the insertion of rows
I also request you to take care on any unforeseen situations which might creep up due to random instances. E.g., what if someone enter some value in B25 instead of B10.
I already faced such situation when the user used the macro "AddRows()" only when two blank rows were remaining in the Main1DB range. In fact that is the main reason that I want the rows to be add automatically instead of user triggered addition of rows.
I used DRAG and FILL as it helped maintain the formatting of entire data range, as the user is not allowed to change the formatting except increasing Column Width.