Problem with "ghosting"

Jeddo

Board Regular
Joined
Jan 26, 2019
Messages
50
Office Version
  1. 2019
Platform
  1. Windows
I'm having problems with portions of images from one worksheet showing up or "ghosting" on another worksheet. I have a workbook with worksheet 1 being comprised solely of buttons to call up userforms and is the only sheet I want users to see or access. I have a macro created to sort a range in worksheet 3. Often, after the macro is executed, a portion of the highlighted range shows up on sheet 1. If I protect sheet 1, a larger image shows up and it happens every time. When I go into sheet 3, the range that was sorted is still highlighted. I've tried recording the Macro where at the end I click out of the range to clear it, but doesn't help.

My sort macro is as follows:
Code:
Range("B6:L220").Select
    ActiveWindow.SmallScroll Down:=-213
    ActiveWorkbook.Worksheets("Auction Items").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Auction Items").Sort.SortFields.Add Key:=Range( _
        "B6"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortNormal
    With ActiveWorkbook.Worksheets("Auction Items").Sort
        .SetRange Range("B6:L220")
        .Header = xlGuess
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
I'm a novice, so any help is appreciated.
 
Last edited by a moderator:

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Code is easier to read and follow (as is illustrated below) if placed inside code tags
- click on </> icon, click inside the box, paste code, amend language to VBA and click continue.

Avoid selecting the sheet. Try this (untested)

VBA Code:
    With ActiveWorkbook.Worksheets("Auction Items")
        .Sort.SortFields.Clear
        .Sort.SortFields.Add Key:=Range("B6"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
        With .Sort
            .SetRange Range("B6:L220")
            .Header = xlGuess
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
    End With
 
Upvote 0
Thanks for the idea, but it didn't work. Can't figure out how to get the sort range to unhighlight. That is the only way I can clear it after it happens, to go to the worksheet I'm sorting and click on an empty cell.
 
Upvote 0
Trial Application.Screenupdating=False before the code and then reset to True after the code. HTH. Dave
 
Upvote 0
Trial Application.Screenupdating=False before the code and then reset to True after the code. HTH. Dave
Thanks, that seems to be working. Range is still highlighted, but it's not bleeding through to the other worksheet, which is what I needed.
 
Upvote 0
You are welcome. I'm guessing you could just code to select some cell at the end of your code to get rid of the highlighted range. Dave
 
Upvote 0
That's what I thought. Wasted a lot of time trying with no luck. I even re-recorded the macros several times selecting empty cells at the end. Would work when I recorded them, but not when I ran them. You're solution is working and I appreciate your help.
 
Upvote 0
Ghosting (screen updating issue) is caused by other sheets having multiple cells selected. No idea why. This also occurs if the currently selected cell is merged with others..

To hack the issue...you need to access each sheet in the workbook and select a single cell. (reset all sheets back to

Use this ghost buster code:

Dim wSheet As Worksheet
On Error Resume Next
Application.ScreenUpdating = False
For Each wSheet In Worksheets
wSheet.Select
Sheets("START").Unprotect Password:="whatever"
Range("A1").Select
Next
Sheets(2).Select

Application.ScreenUpdating = True

*I like my code to run fast, so using the "Application.ScreenUpdating = False" is important, but if you do not turn back to TRUE you'll have issues.
*add "Application.ScreenUpdating = TRUE" to the change code on the worksheet affected if things persist.

Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = True

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,863
Messages
6,121,978
Members
449,058
Latest member
oculus

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