?
Solved

Worksheet Change Event Troubles

Posted on 2012-04-13
5
Medium Priority
?
309 Views
Last Modified: 2012-04-13
Hi,

I am using VBA to control worksheet event (please see vba in attached file)

However, the VBA is not locking/unlocking cell F12 when a choice is selected from F8.

Any help is appreicated on why this is not locking. Password is 1234

Thanks!
Book1.xls
0
Comment
Question by:Shanan212
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 26

Accepted Solution

by:
redmondb earned 2000 total points
ID: 37844364
Hi, Shanan212.

The problem is that F12 is merged with G12. So try replacing the following two lines (in both places)...
.Locked = True
.FormulaHidden = True

Open in new window

... by...
Range("F12:G12").Locked = True
Range("F12:G12").FormulaHidden = True

Open in new window

***EDIT*** Perhaps simply unmerging the cells would be better? (BTW, for "VARIOUS SKIDS", do you mean the value in F12 to be cleared without doing anything with it?)

Regards,
Brian.
0
 
LVL 13

Author Comment

by:Shanan212
ID: 37844554
Thanks that works!

Now the problem is that the code clears the formula init (when changed to Various Skids) and enters NULL.

This makes the box unaccessible to user entry...any suggestions?

Also when a 'Single Skid' option is chosen,

when you enter values in height, length, etc, the boxes' focus is acting weird as well.

Let me know if I should ask these as another question

Thanks!
0
 
LVL 13

Author Closing Comment

by:Shanan212
ID: 37844609
I've solved it by using

.HasFormula to check for formula and clear the box only once.

Thanks for the clear answer and your time!
0
 
LVL 26

Expert Comment

by:redmondb
ID: 37844708
Shanan212,

(1) "This makes the box unaccessible to user entry"
Not for me. Did you unmerge the cells or change the code? Please try attached  - I've tidied up the Ranges (there was another one I missed). I've also (temporarily) commented out the three "On Error Resume Next" lines and the clearing of F12.

(2) "the boxes' focus is acting weird"
Commenting out the ".Select" seemed to fix this.

(3) "Let me know if I should ask these as another question"
Doing fine so far!

Regards,
Brian.Book1V2.xls
0
 
LVL 26

Expert Comment

by:redmondb
ID: 37844718
Thanks, Shanan212.

Apologies for the crossing posts - I should hit Refresh more often!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question