Solved

Populate one sheet based on vlaues in another sheet

Posted on 2011-03-02
7
198 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

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

Author Comment

by:singleton2787
Comment Utility
McOZ, how do I activate this code??
0
 
LVL 9

Accepted Solution

by:
McOz earned 500 total points
Comment Utility
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
Comment Utility
Bravo!!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

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

11 Experts available now in Live!

Get 1:1 Help Now