Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]() Quote:
Apologies for a delay in response. I wasn't feeling well and couldn't see your message. I thought you are always going to use only 1 row. Here is a small edit that you need to make in the code. replace the worksheet_change code in the thisworkbook object with the following code. Private Sub Worksheet_Change(ByVal Target As Range) Dim CheckRng As Range Dim EntryRng As Range Dim ExitRng As Range Set EntryRng = Range(Cells(Target.Row, 1), Cells(Target.Row, 4)) Set ExitRng = Range(Cells(Target.Row, 7), Cells(Target.Row, 10)) Set CheckRng = Application.Union(EntryRng, ExitRng) If Not Application.Intersect(Target, CheckRng) Is Nothing Then If Application.WorksheetFunction.CountBlank(EntryRng) = 0 And Application.WorksheetFunction.CountBlank(ExitRng) = 0 Then If Application.WorksheetFunction.Sum(EntryRng) < Application.WorksheetFunction.Sum(ExitRng) Then MsgBox "The Entry Total is not matching with Exit Total", vbCritical, "Error" Application.EnableEvents = False Application.Undo Application.EnableEvents = True Exit Sub End If End If End If End Sub Hope this helps. Prashant |
#2
![]() |
|||
|
|||
![]() Quote:
i copied the original worksheet of mine Entryexit. then i went for view code. then i pasted your presentcode. p alt f11. saved the doc as macro enabled. when i checked, it does not work as expected. it gives "syntex error" (visual basic) whenever i type something on row2. Last edited by sumesh56 : November 5th 12 at 06:07 PM |
#3
![]() |
|||
|
|||
![]() Quote:
Try these steps. 1) Go to the sheet where you will enter data. 2) on the sheet tab right click 3) Click on View Code 4) It will take you to the VBE window. 5) In the code window (right pane) paste my code. If still unsure send me your file and I will send you the updated file. Thanks, Prashant |
#4
![]() |
|||
|
|||
![]() Quote:
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
conditional formatting for wrongly entered 9 digit numbers | Excel Programming | |||
Using a Macro in Excel 2004 to move entered data from one sheet toanother and space between rows when next data is entered? | Excel Programming | |||
List Box - Option If wrongly selected | Excel Programming | |||
Time displaying wrongly | Excel Discussion (Misc queries) | |||
sorry i put wrongly for padded leading 0 | Excel Programming |