Macro prevents typing in cells, until switching to another tab and back again

bleepy

New Member
Joined
Nov 17, 2013
Messages
3
Hello,

Fairly new to Excel/VBA stuff, so forgive me if I've made a stupid mistake somewhere.

I have a spreadsheet formatted like a calendar, and have some simple ActiveX buttons on the right.

When one of these buttons are clicked, it runs the following macro on the currently selected cell:

Code:
<code>
Sub ColorCodeA()
  Selection.Interior.ColorIndex = 50
End Sub
</code>

There are many macro's like this, running from A through to K (ColorCodeA, ColorCodeB, etc.)

However, once I have clicked this, I can no longer enter any data in to any cells on that sheet until I have switched to another tab, and back to the original one.

It doesn't matter if the cell/sheet/workbook has any protection settings active or not, and I don't have to do anything else except literally switch to another tab and back again.

I'm not sure what could be causing this. I have some other macro's in the workbook, spread across three module's, but this still happens even if they haven't been run since closing and re-opening the workbook.

I would appreciate any assistance in trying to find the source of this annoying problem.

Possible solutions from other forums I have tried are:

Code:
Application.ScreenUpdating = False
<code>Selection.Interior.ColorIndex = 50</code>
Application.ScreenUpdating = True

Code:
<code>Selection.Interior.ColorIndex = 50</code>
Sheets("problemsheet").Select
Range("A1").Select

Regards

Craig
 
Last edited:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
I personally never experienced problems with ActiveX controls embeded in worksheets but I heard this can be an issue

I suggest you replace the ActiveX buttons with normal excel form buttons which are less bugy or if you must keep the activeX buttons try setting their TakeFocusOn_Click (remove the undersocre)Property to False and see if that solves the problem.
 
Last edited:
Upvote 0
I second Jaafar's suggestion to use Forms controls. I had a project once where I used a multi-select listbox ActiveX control and it produced this exact same behaviour.
 
Upvote 0
I personally never experienced problems with ActiveX controls embeded in worksheets but I heard this can be an issue

I suggest you replace the ActiveX buttons with normal excel form buttons which are less bugy or if you must keep the activeX buttons try setting their TakeFocusOn_Click (remove the undersocre)Property to False and see if that solves the problem.

Changing this property fixed it. Working perfectly now, thanks!
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,276
Members
449,075
Latest member
staticfluids

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