Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Excel > Adding rows


Reply
 
Thread Tools Display Modes
  #1  
Old 09-10-2003, 11:07 AM
ridders ridders is offline
Centurion
 
Join Date: Aug 2003
Posts: 134
Default Adding rows


Hello there

I have some code already setup and most of the work is done. Just tweakin here and there.

What i am stuck with is that I have excel poulated with loads of data and its all in percentages. is there anyway Vb can add up all the rows and send the user a message if any row is higher that say 101% or lower that 99%. if its in between then the row is OK. I want a message to come up to say that row X is not correct or somethin.

I also want this done in the background so i dont really want the sum of the row stuck in the s/sheet somewhere

any ideas??

Ta
Reply With Quote
  #2  
Old 09-10-2003, 11:21 AM
TerryTee TerryTee is offline
Contributor
 
Join Date: Aug 2003
Location: Norway
Posts: 450
Default

How about this?
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim val As String
    val = Target.Value
    If IsNumeric(val) Then
        If val <= 99 Or val >= 101 Then
            MsgBox "Error"
        End If
    End If
End Sub
If you have other cells with numbers you might want to add a check to see if the Target.Numberformat is % (not sure of the fastest way of doing this).

-Terry
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Rows wtbonnell General 1 06-03-2003 09:43 PM
MSHFLEXGRID adding rows + FOCUSRECT Maximus General 2 02-05-2003 07:44 AM
Adding Rows to an unbound DBGrid bobba buoy General 0 09-12-2002 10:45 AM
flexgrid adding rows smilemax General 8 05-22-2002 03:00 AM
flexgrid adding rows smilemax General 1 05-16-2002 01:51 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->