Excel - Range.Hidden property

Hello,
I have got a problem with use of Range.Hidden property:
I put the ActiveX CheckBox on my sheet and assigned following procedure:

Private Sub CheckBox1_Click()
    Columns(10).Value = "Abracadabra"
    Columns(10).Hidden = True    
End Sub

The first line is OK (All fields in the Column No.10 are filled with "Abracadabra") whereas the second one fail (Error 1004).

Note that if I put these two lines for instance in Worksheet_Change event, everything is OK.

Regards,
Vladimir
vnej4304Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
WolfgangKoenigConnect With a Mentor Commented:
Beside there exists more errors with ole objects in Excel.
For instance when you embed an command button to the worksheet an then adjust your screen resolution, then it can happen that the behavior of the buttons are crazy. They will resize their font and size randomly ...

More complex an application more bugs they have.

WoK
0
 
WolfgangKoenigCommented:
This will help:
Private Sub CheckBox1_Click()
   Columns(1).Value = "Abracadabra"
   Application.ActiveCell.Select
   Columns(1).Hidden = True
End Sub

You must set the focus to the excel sheet back from
the checkbox ..
0
 
WolfgangKoenigCommented:
You must reset the focus from the ActiveX  Checkbox
to the Excel Worksheet object.

This is probably an old excel bug ...

(This error irritates me really long)
WoK
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
vnej4304Author Commented:
Thank you VERY much for your quick and comprehensive answer.
Have a great day!
Vladimir Nejedly
0
 
vnej4304Author Commented:
Thank you VERY much for your quick and comprehensive answer.
Have a great day!
Vladimir Nejedly
0
 
WolfgangKoenigCommented:
Best regards;o)
WoK
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.