I'm working in VBA and want to insert a row in a specific location without selecting it. The issue I'm having is that after the row is selected, the spreadsheet is scrolled down to that row when the script is finished running. I want to be able to do this without the spreadsheet being scrolled down to the inserted row.
Rows(i & ":" & i).Select
ActiveCell.EntireRow.Insert
I don't want to select A1 to get to the top.
Just do this:
Cells(i,1).EntireRow.Insert
Apply the action directly to the desired range, instead of selecting it first and applying the action to "Activecell".
A few additional notes:
Rows(i & ":" & i).Insert
will insert a row below without changing the selection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With