Hello,
I hope I can explain this clearly. I have this piece of VBA code that I keep on the worksheet level of a spreadsheet- it highlights the column and row of the selected cell (easier to visual track when using a large sheet). Someone on this forum helped me with it.
I also have a Macro that has many many steps- the problem I'm running into is that while the Macro runs each cell the Macro is selecting or changing is being highlighted, which is slowing the Macro down substantially (think 30 seconds to run instead of 3 seconds- and this spreadsheet will be used very very often). The macro I'm using is too large to post here.
How can I prevent the below worksheet level code from running while another Macro is running? I don't need the below worksheet level code to START working until after the Macro is complete- maybe that helps?
Here's my idea, but I don't know how to execute it- maybe I can change the below sheet-level code to only run when a condition is met (say for example the unused cell Q1 has a value of 1), then I can make the last step of the Macro to place that value (1) in cell Q1, so that the sheet level code will start working only when the Macro is complete? I'm sure there's a better way, that was just what I came up with.
Thanks in advance for your help. I've been searching online for hours with no results. I'm not incredibly versed in VBA (I'm learning as I go), so thanks for your patience.
Here's the code that I'm placing on the sheet-level.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim RngRow As Range
Dim RngCol As Range
Dim RngFinal As Range
Dim Row As Long
Dim Col As Long
Cells.Interior.ColorIndex = xlNone
Row = Target.Row
Col = Target.Column
Set RngRow = Range("A" & Row, Target)
Set RngCol = Range(Cells(1, Col), Target)
Set RngFinal = Union(RngRow, RngCol)
RngFinal.Interior.ColorIndex = 15
End Sub
Bookmarks