Screen Flases even though ScreenUpdating is set to false

JONeill

Board Regular
Joined
Sep 2, 2018
Messages
58
I have a macro that uses a cover sheet with a picture on it. The data sheet is hidden. Even though I disable screen updating before every write operation, the picture still flashes when it performs a delete and an insert. The save for an edit is fine. The picture is about 900k and the insert has to resort the data and the delete moves data below the deleted row up one row. I also have to switch sheets to write although, I never make the Data sheet the active sheet. Anybody have any ideas? It's a small thing but it would be nice if I could get it to work right.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Re: Screen Flases even thoush ScreenUpdating is set to false

I think you might need to post the macro ;)
 
Upvote 0
Re: Screen Flases even thoush ScreenUpdating is set to false

Here is the code that adds a record.

Code:
Private Sub AddRecord(ByVal site As clsSite)
    Dim rowNumber As Long

    'Turn off screen updating
    Application.ScreenUpdating = False
    
    'Check to see if site name already exists
    rowNumber = IData.FindSiteRow(DrngPrms, site.siteName)
    
    'Returns a row number so there is
    'a duplicate record in the worksheet
    If rowNumber > 0 Then
        lblErrorMessage.Caption = "There is already a site named " & site.siteName & "..."
        Exit Sub
    End If

    'if successful write
    If IData.WriteNewRow(site, DrngPrms) Then
    
        'Rebuild the data range to
        'account for new record
        DrngPrms.BuildDataRange
        
        'Sort the data
        IData.SortData DrngPrms
        
        'Reset current row to new record locatoin
        currentRow = IData.FindSiteRow(DrngPrms, site.siteName)
        
        'Read the new record
        Set site = IData.ReadRow(currentRow, DrngPrms)
        
            'Fill the form and lock it and reset the
            'current mode to browse
            FillForm site
            LockForm
            
            'Load search combo box
            InitSiteNamesCBO
            
            'Save file after change.
            ActiveWorkbook.Save
        Else
        
            'Set error message if there is a problem
            lblErrorMessage.Caption = "There was a problem writing the record..."
            
        End If
        
        'Turn on screen updating
        Application.ScreenUpdating = True

End Sub
 
Upvote 0
Re: Screen Flases even thoush ScreenUpdating is set to false

After playing around, I think the reason that I get a flash on the front end screen is because of the activity going on after the data is updated. When a new record is saved it's entered after the last row and then has to be sorted. When a deletion occurs, all lower records must be moved up a row. But when an update occurs just that row is overwritten with the new data and no flash occurs. I'm new at this so, if anyone has a better explanation, I'd be happy to hear it.
 
Upvote 0

Forum statistics

Threads
1,215,580
Messages
6,125,654
Members
449,245
Latest member
PatrickL

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