Solved

Worksheet Change Event Troubles

Posted on 2012-04-13
5
305 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
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

860 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