[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Worksheet Change Event Troubles

Posted on 2012-04-13
5
Medium Priority
?
311 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
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…
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 …

650 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