Solved

Populate one sheet based on vlaues in another sheet

Posted on 2011-03-02
7
201 Views
Last Modified: 2012-05-11
This has been asked before, but I couldn't find the exact answer I was looking for..
In the sheet 'Template Requirements' there are some cell with 'n/a' in them. I simply want to populate the sheet 'Data' with JUST the 'N/A' values and make the 'N/A' cells prohibited from changing (i.e. entering data).
dashboard-wipv3a.xlsm
0
Comment
Question by:singleton2787
  • 3
  • 2
  • 2
7 Comments
 
LVL 6

Expert Comment

by:Eric Zwiekhorst
ID: 35018084
Hi Singleton,

I do not understand what you mean with:

I simply want to populate the sheet 'Data' with JUST the 'N/A' values and make the 'N/A' cells prohibited from changing (i.e. entering data).
   
Do you want the possibility to enter data in the N/A filled field just one time, and after that they should be locked?

this is feasable...

Kind reagrds

Eric
0
 
LVL 6

Expert Comment

by:Eric Zwiekhorst
ID: 35018126
Try lock the sheet and leaving unlocked the N/A values.

then put in the sheet macro
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
 Dim myString As String
 Dim cel As Range, TARG As Range
 Dim KOLOM As Integer
Application.EnableEvents = False
On Error Resume Next
Set TARG = Intersect(Target, Range("3:10"))     'Obviously you can change this target range to your desired range
KOLOM = TARG.Column
 If TARG Is Nothing Then
   Application.EnableEvents = True
   Exit Sub
   Else
   myString = TARG
End If
If TARG.Locked = False Then TARG.Locked = True
End Sub


kind regards

Eric
0
 
LVL 9

Expert Comment

by:McOz
ID: 35018133
You could use formulas to populate the N/A values in the Data sheet, then run some code like this in the WorkSheet_Activate event or similar:
Private Sub Worksheet_Activate()
    ActiveSheet.Unprotect
    For Each c In ActiveSheet.UsedRange.Cells
        If c.Value = "N/A" Then c.Locked = True Else c.Locked = False
    Next
    ActiveSheet.Protect
End Sub

Open in new window


Good luck!
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

 

Author Comment

by:singleton2787
ID: 35019439
Zwie, I get an unexpected End Sub on the macro...
0
 

Author Comment

by:singleton2787
ID: 35019449
McOZ, how do I activate this code??
0
 
LVL 9

Accepted Solution

by:
McOz earned 500 total points
ID: 35019513
1. Right click on the "Data" sheet tab at the bottom, and choose "View Code"
2. Copy and paste the code into the window, and save.
3. whenever you go to the Data sheet, it will automatically run this code, which locks all cells containing the value "N/A"

Cheers!
0
 

Author Closing Comment

by:singleton2787
ID: 35037646
Bravo!!
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…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
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…

820 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