Is there a vba code that can do the following: select the first row cell in column M…
- User
Is there a vba code that can do the following:
select the first row cell in column M then every half a second, select the next cell below (downwards) and continue selecting until an empty cell is reached. When an empty cell is reached then continue the selection upwards and stop when row 1 (M1) is reached. If a click is made in any cell (selection change) is made, the process stops (exit sub) My column M has 54 rows with values in it.
- Assistant
- User
Forgot to mention that the code is to work for sheet 'All Checks'
- Assistant
Certainly! You can modify the VBA code to specifically work with a sheet named "All Checks." Here is the updated code:
- User
the idea of the code was to create an auto scroll behaviour of the page. What I have noticed is that one, the loop cannot be interupted by a selection event, two, it appears that vba does bot support a wait stae of half a second. Are there any other solutions and is it possible to interupt the loop
- Assistant
- User
Th AutoScroll works as it should do. However, because of other events in my 'Worksheet_SelectionChange' I have had to include into the code 'Application.EnableEvents = False'. I believe that as a result of this, the 'StopAutoScroll' is not stopping the loop when called. If this is the cause, is there a way to inculde in the vba below 'Worksheet_SelectionChange' a condition just below the StopAutoScroll condition, that checks if the code 'Sub StartAutoScroll()' is running, and if it is running, then it exits the sub so that other parts of the 'Worksheet_SelectionChange' are skipped. Also, I believe that the condition; 'If Target.Worksheet.Name = "All Checks" Then StopAutoScroll End If' should incude a condition that eliminates column M, so that the code 'Sub StartAutoScroll()' is not affected by it. What do you think of my suggestions?
- Assistant