Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default Default Cell value in changing environment

I don't know if this is possible to do, but I figured I'd ask. I have a
workbook where the first worksheet populates data on employees based on their
name selected from a drop down cell. All of the data populates fine here.
There is one cell that is a subjective rating decided upon by managers
(Coaching Score). I run into an issue where the value selected in the
Coaching Score cell remains the same when you switch between employees. Is
there any way to have this cell reset to a default value every time you
switch employees on the front sheet? I've tried some formulas, but every
time you select a rating in the Coaching Score cell, it replaces the fomula
with the value selected. Is there any way I can fix this? Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,203
Default Default Cell value in changing environment

Put the code below into the worksheet code module for the sheet where you
enter/switch the employee name. To do it easily, choose that sheet and
right-click on it's name tab and choose [View Code] from the list. Then
copy, paste and edit the code below into that module and close the vb editor.

Private Sub Worksheet_Change(ByVal Target As Range)
'change these Const values as needed
'
'cell address on this sheet where employee name is
'entered/selected
Const empNameCell = "$A$1" ' be sure to use $ symbols.

'name of sheet where the coaching score cell is
'even if it is this same sheet
Const csSheetName = "CoachingScoreSheet"

'cell address for the coaching score entry
Const csCell = "$G$6" ' dollar symbols not required here

'this must be a valid phrase for the coaching score entries
Const csDefault = "Default Score" 'or set to number if needed

If Target.Address < empNameCell Then
'not a name change
Exit Sub
End If
ThisWorkbook.Worksheets(csSheetName).Range(csCell) = csDefault

End Sub


"TheDrescher" wrote:

I don't know if this is possible to do, but I figured I'd ask. I have a
workbook where the first worksheet populates data on employees based on their
name selected from a drop down cell. All of the data populates fine here.
There is one cell that is a subjective rating decided upon by managers
(Coaching Score). I run into an issue where the value selected in the
Coaching Score cell remains the same when you switch between employees. Is
there any way to have this cell reset to a default value every time you
switch employees on the front sheet? I've tried some formulas, but every
time you select a rating in the Coaching Score cell, it replaces the fomula
with the value selected. Is there any way I can fix this? Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default Default Cell value in changing environment

Thanks for the help with the code! When I change everything around to
correspond with the sheet, I get a Runtime Error '424' Object Required Error.
The code I used is:
Private Sub Worksheet_Change(ByVal Target As Range)

Const empNameCell = "$A$9"
Const csSheetName = "MainPage"
Const csCell = "CoachRating"
Const csDefault = "Select"

If Target.Address < empNameCell Then

Exit Sub
End If
SalesManagersCoachingReport.Worksheets(MainPage).R ange(CoachRating) =
csDefault

End Sub

When the debugger comes up it highlights the line
SalesManagersCoachingReport.Worksheets(MainPage).R ange(CoachRating) =
csDefault

Is this error stemming from the fact that the coaching rating cell is named?
I did this because the rating selected influences the metrics on other
sheets.


"JLatham" wrote:

Put the code below into the worksheet code module for the sheet where you
enter/switch the employee name. To do it easily, choose that sheet and
right-click on it's name tab and choose [View Code] from the list. Then
copy, paste and edit the code below into that module and close the vb editor.

Private Sub Worksheet_Change(ByVal Target As Range)
'change these Const values as needed
'
'cell address on this sheet where employee name is
'entered/selected
Const empNameCell = "$A$1" ' be sure to use $ symbols.

'name of sheet where the coaching score cell is
'even if it is this same sheet
Const csSheetName = "CoachingScoreSheet"

'cell address for the coaching score entry
Const csCell = "$G$6" ' dollar symbols not required here

'this must be a valid phrase for the coaching score entries
Const csDefault = "Default Score" 'or set to number if needed

If Target.Address < empNameCell Then
'not a name change
Exit Sub
End If
ThisWorkbook.Worksheets(csSheetName).Range(csCell) = csDefault

End Sub


"TheDrescher" wrote:

I don't know if this is possible to do, but I figured I'd ask. I have a
workbook where the first worksheet populates data on employees based on their
name selected from a drop down cell. All of the data populates fine here.
There is one cell that is a subjective rating decided upon by managers
(Coaching Score). I run into an issue where the value selected in the
Coaching Score cell remains the same when you switch between employees. Is
there any way to have this cell reset to a default value every time you
switch employees on the front sheet? I've tried some formulas, but every
time you select a rating in the Coaching Score cell, it replaces the fomula
with the value selected. Is there any way I can fix this? Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 457
Default Default Cell value in changing environment

Sounds like you'd have to use some type or VB script, such as the
Worksheet_Change event. An example:

Private Sub Worksheet_Change(ByVal Target As Range)
'Did the user change cell A1?
If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub
Application.EnableEvents = False

'Do stuff here
'Clear cell contents
Range("A2").ClearContents
'Or, give the cell a formula
Range("A2").Formula = "=SUM(B1:B2)"

Application.EnableEvents = True
End Sub

--
Best Regards,

Luke M
"TheDrescher" wrote in message
...
I don't know if this is possible to do, but I figured I'd ask. I have a
workbook where the first worksheet populates data on employees based on
their
name selected from a drop down cell. All of the data populates fine here.
There is one cell that is a subjective rating decided upon by managers
(Coaching Score). I run into an issue where the value selected in the
Coaching Score cell remains the same when you switch between employees.
Is
there any way to have this cell reset to a default value every time you
switch employees on the front sheet? I've tried some formulas, but every
time you select a rating in the Coaching Score cell, it replaces the
fomula
with the value selected. Is there any way I can fix this? Thanks!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing default margins Louise Excel Worksheet Functions 2 May 3rd 07 12:04 PM
Changing the default delimiter LucasA Excel Discussion (Misc queries) 1 February 27th 07 04:42 AM
changing default shortcut - please help! HeatherErin Excel Discussion (Misc queries) 1 May 10th 06 08:21 PM
Changing file default Drn Xcl Excel Worksheet Functions 0 March 31st 06 03:38 PM
changing format default Mark Links and Linking in Excel 1 March 15th 05 01:15 AM


All times are GMT +1. The time now is 10:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"