Solved

Worksheet Change Event Troubles

Posted on 2012-04-13
5
302 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks, Shanan212.

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

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
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 …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now