JonWestcot
New Member
- Joined
- Oct 21, 2010
- Messages
- 6
Hi all:
I'm working on a bit of VBA code that is used to insert a variable number of rows into a spreadsheet at a particular point on the sheet. The insert is working just fine now (after I managed to figure out some -- to me -- bizarre behavior on Excel's part), except for one thing. The particular sheet on which the inserts occur has rows at the top of the sheet that are locked (i.e., non-scrolling). A cell below the locked rows must be selected before the insert can proceed. After the insert, the previously selected cell is Activated, but I also need to ensure that it always shows up on the screen.
Here's an example:
On my particular screen, it will display 50 rows. The top 10 rows are locked (via Range.FreezePanes). If I scroll down to row 70 and insert 5 rows (via my VBA code), the highlighted cell will make its way to row 75. However, after the code runs, the displayed rows are again 1 through 50, although the highlighted cell is correctly highlighted where it should be -- it just isn't VISIBLE.
According to the Help documentation, Range.Show is supposed to scroll the rows to ensure that the highlighted cell is visible on the screen. But it doesn't seem to work.
Any suggestions? Should I try to force a scrolling of the rows through VBA code? And how would I even DO that?
Thanks in advance!
Sincerely,
Jon
I'm working on a bit of VBA code that is used to insert a variable number of rows into a spreadsheet at a particular point on the sheet. The insert is working just fine now (after I managed to figure out some -- to me -- bizarre behavior on Excel's part), except for one thing. The particular sheet on which the inserts occur has rows at the top of the sheet that are locked (i.e., non-scrolling). A cell below the locked rows must be selected before the insert can proceed. After the insert, the previously selected cell is Activated, but I also need to ensure that it always shows up on the screen.
Here's an example:
On my particular screen, it will display 50 rows. The top 10 rows are locked (via Range.FreezePanes). If I scroll down to row 70 and insert 5 rows (via my VBA code), the highlighted cell will make its way to row 75. However, after the code runs, the displayed rows are again 1 through 50, although the highlighted cell is correctly highlighted where it should be -- it just isn't VISIBLE.
According to the Help documentation, Range.Show is supposed to scroll the rows to ensure that the highlighted cell is visible on the screen. But it doesn't seem to work.
Any suggestions? Should I try to force a scrolling of the rows through VBA code? And how would I even DO that?
Thanks in advance!
Sincerely,
Jon