Thread
:
how to get a warning when data is entered wrongly
View Single Post
#
12
Posted to microsoft.public.excel.misc
[email protected]
external usenet poster
Posts: 168
how to get a warning when data is entered wrongly
On Thursday, October 18, 2012 9:25:33 AM UTC-7, sumesh56 wrote:
;1606468 Wrote:
On Wednesday, October 17, 2012 10:25:30 AM UTC-7, sumesh56 wrote:-
;1606419 Wrote:
-
On Tuesday, October 16, 2012 10:30:23 AM UTC-7, sumesh56 wrote:--
--
i have a spreadsheet. The ENTRY and EXIT should tally.--
--
--
--
ENTRY----total of col A:D is in E2.--
--
--
--
EXIT---- total of col G:J is in K2.--
--
--
--
Cell K is formatted as E2=K2--
--
--
--
cell K2 is formatted as the sum of G:J--
--
--
--
when i enter a data wrongly in anywhere between the cells G:J a--
-
warning-
--
--
--
should come in col K2(of course after entering in all the four
cells--
--
--
--
G:J).the idea is the number in entry should tally with that of
the--
-
exit.-
--
--
--
is it possible?--
--
--
--
the excel file is attached.--
--
--
--
--
--
--
--
--
--
--
--
+-------------------------------------------------------------------+--
--
--
--
|Filename: entry and exit.zip
|--
--
--
--
|Download:--
-
http://www.excelbanter.com/attachment.php?attachmentid=626|-
--
--
--
+-------------------------------------------------------------------+--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
-- --
--
--
--
sumesh56---
-
-
-
See if this does what you want. -
-
Copy into the sheet module.-
-
-
-
Private Sub Worksheet_Change(ByVal Target As Range)-
-
Dim I As Integer, J As Integer-
-
I = Range("E3")-
-
J = Range("K3")-
-
If I < J Then-
-
MsgBox "E Does Not Equal K"-
-
End If-
-
End Sub-
-
-
-
Regards,-
-
Howard-
thanks for the reply. but ,i am not able to understand what do you
mean
by sheet module. where can i find that?
+-------------------------------------------------------------------+
+-------------------------------------------------------------------+
--
sumesh56-
Copy the code I sent, Ctrl + c, right click the sheet tab and click on
View Code. This will take you to the
vb
editor. Paste, Ctrl + v, the
code in the large white area. Now hit Alt + F11 to return to the
worksheet.
Test fly the code by making entries in notable cells. If E3 and K3 do
not match you should get a Message Box alerting you.
Note, in your post you mention E2 & K2 not matching. I assumed you
meant E3 & K3.
Regards,
Howard
hai Howard,
thanks for the reply. i did your steps. but sorry,it does not work as i
wished.
pls see the attached excel file again. I have to enter the data of
"entry" from col A:D and its total is in col E3. I would like to make
entries A:D without getting any error message. the total should come in
E3 of course without any error message.
then comes to the next part"exit" entries of which will be in col G:J.
here also I should be allowed to make entries in col G:J without EM. Now
comes the main part. the total of G:J should come in col K3. Here in col
K3 if the total does not equal E3 because of the entries in col G:J are
wrong, I should get an EM.
Now after doing the
VB
code,i get EM after each and every data entry in
any one of the col from A:D and G:J. I have to hit the Enter button
twice to get rid of the EM and to pass the cursor to the next cell.
E3=K3 if it does not equal i should get the EM.I require something which
can connect only with these columns and not with other columns. i think
i could express my idea.thanks
+-------------------------------------------------------------------+
+-------------------------------------------------------------------+
--
sumesh56
Try this, assumes you will make all the entries and the activecell is K3 after all those entries are made. It works for me to start in cell A3 and after each entry use the "Right Arrow" key to advance throught the field and after the entry in J3, you will be in cell K3.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If ActiveCell < Range("K3") Then Exit Sub
Dim I As Integer, J As Integer
I = Range("E3")
J = Range("K3")
If I < J Then
MsgBox "E Does Not Equal K"
End If
End Sub
Regards,
Howard
Reply With Quote
[email protected]
View Public Profile
Find all posts by
[email protected]