Activate slows down cursor

EssKayKay

Board Regular
Joined
Jan 5, 2003
Messages
222
Office Version
  1. 2007
Platform
  1. Windows
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:

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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.
 
Upvote 0
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:
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top