PC Review


Reply
Thread Tools Rate Thread

Display alert if data exists

 
 
Jim G
Guest
Posts: n/a
 
      25th Jan 2008
I have a hidden sheet that compares the two lists to find additions in a new
list compared with the current list and displays the result in the first rows
of an adjacent column. Is there a way to check if differences are listed in
column D and if so, display a pop up message to alert the user to take action
in updating the master list? I want this to be part of a larger routine, so
if there are no differences then continue with the existing proceedure.

Sub CreateFormulaCols()
' will compare two lists and display the resilts at the top of the first page
'Formulas are copied to the last row with data in Col B. This should be the
exhaustive set

With Worksheets("RefList")
Lastrow = .Cells(.Rows.Count, "B").End(xlUp).Row
.Range("c1:C" & Lastrow).Formula =
"=IF(RC[-2]="""","""",IF(ISNUMBER(MATCH(RC[-2],C[-1],0)),"""",ROW()))"
.Range("D1" & Lastrow).Formula =
"=IF(ISERROR(SMALL(C[-1],ROW(RC[-3]))),"""",INDEX(C[-3],MATCH(SMALL(C[-1],ROW(RC[-3])),C[-1],0)))"
.Range("E1:E" & Lastrow).Formula =
"=IF(RC[-3]="""","""",IF(ISNUMBER(MATCH(RC[-3],C[-4],0)),"""",ROW()))"
.Range("F1:F" & Lastrow).Formula =
"=IF(ISERROR(SMALL(C[-1],ROW(RC[-5]))),"""",INDEX(C[-4],MATCH(SMALL(C[-1],ROW(RC[-5])),C[-1],0)))"

End With
End Sub
--
Jim
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      25th Jan 2008
First, I'd use .formulaR1C1 instead of .Formula. Excel/VBA can forgive you, but
doesn't have to.

Second, I'm not sure what column/formula returns the error or difference
indicator, but maybe you could use test like:

if application.countif(.range("x1:x" & lastrow), "yourindicator") > 0 then
'found a difference
'what should happen

You may need to add another column or change one of the formulas to return a
nice indicator that you can search for. (I told you I'm confused!)

Jim G wrote:
>
> I have a hidden sheet that compares the two lists to find additions in a new
> list compared with the current list and displays the result in the first rows
> of an adjacent column. Is there a way to check if differences are listed in
> column D and if so, display a pop up message to alert the user to take action
> in updating the master list? I want this to be part of a larger routine, so
> if there are no differences then continue with the existing proceedure.
>
> Sub CreateFormulaCols()
> ' will compare two lists and display the resilts at the top of the first page
> 'Formulas are copied to the last row with data in Col B. This should be the
> exhaustive set
>
> With Worksheets("RefList")
> Lastrow = .Cells(.Rows.Count, "B").End(xlUp).Row
> .Range("c1:C" & Lastrow).Formula =
> "=IF(RC[-2]="""","""",IF(ISNUMBER(MATCH(RC[-2],C[-1],0)),"""",ROW()))"
> .Range("D1" & Lastrow).Formula =
> "=IF(ISERROR(SMALL(C[-1],ROW(RC[-3]))),"""",INDEX(C[-3],MATCH(SMALL(C[-1],ROW(RC[-3])),C[-1],0)))"
> .Range("E1:E" & Lastrow).Formula =
> "=IF(RC[-3]="""","""",IF(ISNUMBER(MATCH(RC[-3],C[-4],0)),"""",ROW()))"
> .Range("F1:F" & Lastrow).Formula =
> "=IF(ISERROR(SMALL(C[-1],ROW(RC[-5]))),"""",INDEX(C[-4],MATCH(SMALL(C[-1],ROW(RC[-5])),C[-1],0)))"
>
> End With
> End Sub
> --
> Jim


--

Dave Peterson
 
Reply With Quote
 
Jim G
Guest
Posts: n/a
 
      25th Jan 2008
I'll giev the R1C1 a try, although, I didn't think it mattered since it
works-as a novice some of this confuses me too!

I have two lists Col A & Col B taken from a new data set and the other from
a fixed data set in their respective sheets. The formulas test these for
differences. since there are over a thousand rows, the result is listed in
the top rows of Col D. This can be zero or many. Col F returns the list of
unused codes.

The original lists are created from text reports and used to poulate a
template. I want to alert the user that there is a difference in the new list
and to update the template list. What do you think is the best way to
accomplish this?

--
Jim


"Dave Peterson" wrote:

> First, I'd use .formulaR1C1 instead of .Formula. Excel/VBA can forgive you, but
> doesn't have to.
>
> Second, I'm not sure what column/formula returns the error or difference
> indicator, but maybe you could use test like:
>
> if application.countif(.range("x1:x" & lastrow), "yourindicator") > 0 then
> 'found a difference
> 'what should happen
>
> You may need to add another column or change one of the formulas to return a
> nice indicator that you can search for. (I told you I'm confused!)
>
> Jim G wrote:
> >
> > I have a hidden sheet that compares the two lists to find additions in a new
> > list compared with the current list and displays the result in the first rows
> > of an adjacent column. Is there a way to check if differences are listed in
> > column D and if so, display a pop up message to alert the user to take action
> > in updating the master list? I want this to be part of a larger routine, so
> > if there are no differences then continue with the existing proceedure.
> >
> > Sub CreateFormulaCols()
> > ' will compare two lists and display the resilts at the top of the first page
> > 'Formulas are copied to the last row with data in Col B. This should be the
> > exhaustive set
> >
> > With Worksheets("RefList")
> > Lastrow = .Cells(.Rows.Count, "B").End(xlUp).Row
> > .Range("c1:C" & Lastrow).Formula =
> > "=IF(RC[-2]="""","""",IF(ISNUMBER(MATCH(RC[-2],C[-1],0)),"""",ROW()))"
> > .Range("D1" & Lastrow).Formula =
> > "=IF(ISERROR(SMALL(C[-1],ROW(RC[-3]))),"""",INDEX(C[-3],MATCH(SMALL(C[-1],ROW(RC[-3])),C[-1],0)))"
> > .Range("E1:E" & Lastrow).Formula =
> > "=IF(RC[-3]="""","""",IF(ISNUMBER(MATCH(RC[-3],C[-4],0)),"""",ROW()))"
> > .Range("F1:F" & Lastrow).Formula =
> > "=IF(ISERROR(SMALL(C[-1],ROW(RC[-5]))),"""",INDEX(C[-4],MATCH(SMALL(C[-1],ROW(RC[-5])),C[-1],0)))"
> >
> > End With
> > End Sub
> > --
> > Jim

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I alert user (ASAP) if record already exists? =?Utf-8?B?eW5qcmFtZXk=?= Microsoft Access Forms 2 5th Apr 2006 07:59 PM
Alert uset if a duplicate exists? =?Utf-8?B?SmVuYWk=?= Microsoft Outlook Form Programming 8 28th Jul 2005 05:51 PM
Indexed record ID if it exists alert Hanksor Microsoft Access Forms 4 17th Mar 2005 02:29 PM
Detecting if data exists on "Insert Into" and changing the value in field if exists! Les Microsoft Access Form Coding 2 8th Apr 2004 11:38 AM
using Crystal Reports to display data in my dataset correctly (display the data I selected instead of all the data in table) JK Microsoft C# .NET 1 6th Sep 2003 10:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:05 PM.