Solved

Worksheet Change Event Troubles

Posted on 2012-04-13
5
306 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 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

Suggested Solutions

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

696 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