KX13ZN
New Member
- Joined
- Sep 12, 2019
- Messages
- 34
- Office Version
- 365
- 2019
- 2010
- Platform
- Windows
- Mobile
- Web
I have macro that runs from an 'activecell' that copies the active row, macro included into the row right below it. Its a simple insert new row macro. Now my problem is i only need 16 continuous rows. After 16 rows i need a different event to trigger. But i can't figure out how to count 16 continuous rows when you can insert rows from any point in the 16 row continuum.
There are blank cells above and below the first instance of the active cell before the macro is run.
eg:
blank
macro <- insert macro can be run from this cell
blank
running the macro would make it:
blank
macro <- insert macro can be run from this cell
macro <- insert macro can be run from this cell
blank
So i need a row count to check above and below the active cell(macro) and if the total rows counted is higher than 16 then the macro doesn't run.
I've looked at count rows until blank but i can't figure out how the code works or how to adapt it to my needs
Please help, i would really appreciate some advice.
While it may not be needed the insert macros code is:
There are blank cells above and below the first instance of the active cell before the macro is run.
eg:
blank
macro <- insert macro can be run from this cell
blank
running the macro would make it:
blank
macro <- insert macro can be run from this cell
macro <- insert macro can be run from this cell
blank
So i need a row count to check above and below the active cell(macro) and if the total rows counted is higher than 16 then the macro doesn't run.
I've looked at count rows until blank but i can't figure out how the code works or how to adapt it to my needs
Please help, i would really appreciate some advice.
While it may not be needed the insert macros code is:
Code:
ActiveSheet.Unprotect
ActiveCell.EntireRow.Select
Selection.Copy
Selection.Insert Shift:=xlDown
ActiveSheet.Select
ActiveSheet.protect
ActiveSheet.EnableSelection = xlUnlockedCells