LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Enforced entries code

The purpose of this code, located in the “Scorecard” worksheet module
is to insure users enter numeric weighting values (formatted percent
in four cell ranges. The sum of the four weights cannot be greate
than 100%. I plan to enforce this rule by preventing users for
leaving the “Scorecard” worksheet, other than closing without saving
without entering a numeric value greater than zero:

Cell Range Name
G26:I26 Customer Weighting
G44:I44 Financial Weighting
AG26:AI26 L & G Weighting
AG44:AI44 Process Weighting

Using an Auto_Open sub in Module 1, the workbook opens on th
“Scorecard” worksheet, and the four cell ranges are initially blank.

If the user does not enter proper values, I want a message to come u
saying “A weight greater than zero must be entered for Custome
Weighting” - which would apply to cell range G26:I26. The messag
would change to L&G Weighting, etc., depending on which cell(s) remai
blank or not greater than zero. If more than one cell offends, th
message would include the names of offending cells.

Users leave the “Scorecard” worksheet for another worksheet by clickin
on a hyperlinked cell range, which has a (text) number, 1 through 4, i
it. (A command button would work very easily here, but the boss says n
– doesn’t like how a command button looks – and he’s right, the numbe
does look neat.)

Number Range What clicking does
"1” C12:D16 takes user to the “Customer” worksheet
“2” C30:D34 takes user to the “Financial” worksheet
“3” AC12:AD16 takes user to the “L & G” worksheet
“4” AC30:AD34 takes user to the “Process” worksheet

Once populated, saved, and opened again by the user, the rule of value
greater than zero continues to apply, with the same warning message.

The code below this is not working. Can someone unravel this for me?
Is a function the way to go, as opposed to a sub? The “message
portion of the code need change.

Private Function CheckRange(Cell As Range)
Dim sMsg As String
Dim cellOK As Boolean
cellOK = False
If IsEmpty(Cell) Then
cellOK = False
ElseIf IsNumeric(Cell.Vallue) = False Then
cellOK = True
Else
If Cell.Value <= 0 Then
cellOK = False
End If
End If
If cellOK Then
'do nothing
Else
sMsg = "Weight for Cell(s)" & _
Cell.MergeArea.Address(False, False) & _
"must be entered, and must be greater than zero."
End If
CheckRange = sMsg & vbCrLf
End Functio

--
Message posted from http://www.ExcelForum.com

 
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
"clear contents" is not working. a list is still enforced. peterg11 Excel Worksheet Functions 1 March 9th 10 10:05 PM
VBA Code macro for duplicate entries KCG Excel Discussion (Misc queries) 2 April 30th 08 06:58 AM
Combine Multiple Entries with differing amounts of entries Katie Excel Worksheet Functions 2 November 28th 07 09:53 PM
How can "data validation" be enforced in calculated cells NirA Excel Worksheet Functions 1 March 24th 06 06:13 PM
Counting entries by color code Carmen Excel Discussion (Misc queries) 3 September 19th 05 09:45 PM


All times are GMT +1. The time now is 09:02 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"