full screen yes/no switch with recording last active cell keeps repeating with cell activation

littlepete

Well-known Member
Joined
Mar 26, 2015
Messages
503
Office Version
  1. 365
Platform
  1. Windows
VBA Code:
Sub volledigscherm() ' - control L - [f11]
Set dezecel = ActiveCell
If Not Application.DisplayFullScreen Then
    Application.DisplayFullScreen = True
Else
    Application.DisplayFullScreen = False
End If
If ActiveCell.Row < 5 Then
Range("a5").Select
Else
dezecel.Select
End If
End Sub


hello all :)

I use an adjusted full screen switch on/off with a function key F11 ...
It works perfectly ! it records the active cell, then switches to full or not full screen, and then selects the last active cell again !

so far, so good, but:
i am adding cell activation to start macro's with a click on a cell in row three... that way clicking on cell E3 should start the full screen macro.
but, because the last active cell is effectively that cell E3 the full screen macro keeps repeating itself...

is there a way to stop that, or just do the macro once each time?

have a nice weekend all :) !!!
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
You didn't post your event code, so this is a bit of a guess, but adding a couple of Application.EnableEvents statements should do it.

VBA Code:
Sub volledigscherm() ' - control L - [f11]
    Set dezecel = ActiveCell
    If Not Application.DisplayFullScreen Then
        Application.DisplayFullScreen = True
    Else
        Application.DisplayFullScreen = False
    End If
    Application.EnableEvents = False  '<--- events off
    If ActiveCell.Row < 5 Then
        Range("a5").Select
    Else
        dezecel.Select
    End If
    Application.EnableEvents = True '<--- events on
End Sub
 
Upvote 0
Solution
hello :)

i did try the application.enableevents job, put probably i put it in the wrong places...
now it's working perfectly :) !!!

thank you for your fast and correct answer, wishing you an enjoyable sunday !
 
Upvote 0

Forum statistics

Threads
1,215,443
Messages
6,124,890
Members
449,194
Latest member
JayEggleton

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