Activate slows down cursor

EssKayKay

Board Regular
Joined
Jan 5, 2003
Messages
91
Hey Doug etal,

I’m running your code to highlight the column B cell based on the active row (see code below). It’s doing just what I want and for that I thank you.

I also have a macro that assists in printing (PrintLoanInfo – see below). I created this using Excel’s macro recorder. For the most part, this too is doing what I want. However, I just noticed a little anomaly. The “highlight” routine works perfect until the print macro is run. Once PrintLoanInfo is run up or down cursor/arrow movement slows down. There is a considerable lag after each arrow up or down (left-right works fine).

As I noted before, I am no programmer so please bear with me. As a test I remarked out some lines in my print macro. What I found was if any “Active” process (ActiveSheet or ActiveWindow) is included the slowdown happens. If I exclude all three “active” lines there is no slowdown (the print macro fails but that’s to be expected). If I included just one active process it slows down.

My question – what is Active.xxx doing and is it possible to “deactivate” such processes?

Here are the two routines:

Code:
===== Highlight Code =============================

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Range("A32:K1500")) Is Nothing Then
        With Sheet1.Range("C32:C1500").Font
            .Bold = False
            .Size = 8
            .ColorIndex = 0
        End With

        With Sheet1.Range("C" & Target.Row).Font
            .Bold = True
            .Size = 8
            .ColorIndex = 3
        End With
    End If
End Sub
========================================================

===== Print Macro =======================================

Sub PrintLoanInfo()
    Range("B2:K26").Select
    ActiveSheet.PageSetup.PrintArea = "$B$2:$K$26"
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
    ActiveSheet.PageSetup.PrintArea = ""
    
    PrintForm.Hide
    Range("A4").Select
    Range("B2:J2").Select
End Sub
=========================================================

Any suggestions would be greatly appreciated.

Thanks,
Steve

Split from
https://www.mrexcel.com/forum/excel-questions/1089413-highlight-cell-based-position-active-cell.html
 
Last edited by a moderator:

Some videos you may like

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,430
Office Version
  1. 365
Platform
  1. Windows
Cross posted https://www.excelforum.com/excel-pr...esheet-slows-down-cursor-arrow-movements.html

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 

EssKayKay

Board Regular
Joined
Jan 5, 2003
Messages
91
Hey Doug etal,

I’m running your code to highlight the column B cell based on the active row (see code below). It’s doing just what I want and for that I thank you.

I also have a macro that assists in printing (PrintLoanInfo – see below). I created this using Excel’s macro recorder. For the most part, this too is doing what I want. However, I just noticed a little anomaly. The “highlight” routine works perfect until the print macro is run. Once PrintLoanInfo is run up or down cursor/arrow movement slows down. There is a considerable lag after each arrow up or down (left-right works fine).

As I noted before, I am no programmer so please bear with me. As a test I remarked out some lines in my print macro. What I found was if any “Active” process (ActiveSheet or ActiveWindow) is included the slowdown happens. If I exclude all three “active” lines there is no slowdown (the print macro fails but that’s to be expected). If I included just one active process it slows down.

My question – what is Active.xxx doing and is it possible to “deactivate” such processes?

Here are the two routines:

Code:
===== Highlight Code =============================

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Range("A32:K1500")) Is Nothing Then
        With Sheet1.Range("C32:C1500").Font
            .Bold = False
            .Size = 8
            .ColorIndex = 0
        End With

        With Sheet1.Range("C" & Target.Row).Font
            .Bold = True
            .Size = 8
            .ColorIndex = 3
        End With
    End If
End Sub
========================================================

===== Print Macro =======================================

Sub PrintLoanInfo()
    Range("B2:K26").Select
    ActiveSheet.PageSetup.PrintArea = "$B$2:$K$26"
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
    ActiveSheet.PageSetup.PrintArea = ""
    
    PrintForm.Hide
    Range("A4").Select
    Range("B2:J2").Select
End Sub
=========================================================

Any suggestions would be greatly appreciated.

Thanks,
Steve

Split from
https://www.mrexcel.com/forum/excel-questions/1089413-highlight-cell-based-position-active-cell.html

Well this is not the best answer but it works. What I did was add code to save the workbook; then reopen it.

Sub PrintLoanInfo()
ActiveSheet.PageSetup.PrintArea = "$B$2:$K$26"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveSheet.PageSetup.PrintArea = ""
PrintForm.Hide
Range("A4").Select
Range("B2:J2").Select

ThisWorkbook.Save
Application.Workbooks.Open (ThisWorkbook.FullName)

End Sub
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,109,167
Messages
5,527,195
Members
409,750
Latest member
saiatchut

This Week's Hot Topics

Top