Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Check no. of records have copied correctly

If anyone could help with this. it would be much appreciated:

User's workbook has sheets with data in cols A:G
They 'mark' the rows to be copied with a capital letter in
either col H, I, or J. So if row 50 had 'A' in col H and
'K' in col J, then user wishes to send that record to
Clients 'A' and 'K'.
A Collection (mstrList) is built, containing the unique values
found in cols H:J and the values are then loaded into a
multicolumn listbox in a form:
' Add the sorted, non-duplicated items to a ListBox
For Each Item In mstrList
frmName_Contractors.lbDataCode.AddItem Item
Next Item
The user can now enter the true Client name against the
relevenr record identifier ( A, B, Z etc).
A new workbook is created, containing only worksheets
in 'mstrList' and named accordingly (A, B, Z etc).
Code then runs on the original workbook, sampling through
cols H:J and copying records to the new workbook,
such that all records tagged 'A' end up in newbook
sheet name 'A' etc, etc.
This code also copies any values in cols "H:J".

What I would like to do is to crosscheck the number of
records tagged 'A' (or whatever) in the original book, with
the records found in newbook(sheetA) or whatever.

It seems to me that I could use the values in 'mstrList' to
count each instance of each value in cols "H:J" in the
original book, and then do the same in the new book.

If so, then how could I achieve this, and also compare
and alert if there is a problem, please?

Regards.



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 01/09/2003


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Check no. of records have copied correctly

set srcSh = Worksheets("Whatever") ' sheet with original H:I data
for i = 0 to frmName_Contractors.lbDataCode.Listcount-1
sName = frmName_Contractors.lbDataCode.List(i,0)
num = Application.Countif(srcSh.Range("H1:J50"),sName)
set sh = Workbooks("otherbook.xls").Worksheets(sName)
if sh.cells(rows.count,1).end(xlup).Row < num then
msgbox "Problems"
' if you have header rows in the sheet, adjust the comparison
' to account for these
end if
Next

or

for each itm in mstrList
sName = itm
num = Application.Countif(srcSh.Range("H1:J50"),sName)
set sh = Workbooks("otherbook.xls").Worksheets(sName)
if sh.cells(rows.count,1).end(xlup).Row < num then
msgbox "Problems"
' if you have header rows in the sheet, adjust the comparison
' to account for these
end if
Next


--
Regards,
Tom Ogilvy


Stuart wrote in message
...
If anyone could help with this. it would be much appreciated:

User's workbook has sheets with data in cols A:G
They 'mark' the rows to be copied with a capital letter in
either col H, I, or J. So if row 50 had 'A' in col H and
'K' in col J, then user wishes to send that record to
Clients 'A' and 'K'.
A Collection (mstrList) is built, containing the unique values
found in cols H:J and the values are then loaded into a
multicolumn listbox in a form:
' Add the sorted, non-duplicated items to a ListBox
For Each Item In mstrList
frmName_Contractors.lbDataCode.AddItem Item
Next Item
The user can now enter the true Client name against the
relevenr record identifier ( A, B, Z etc).
A new workbook is created, containing only worksheets
in 'mstrList' and named accordingly (A, B, Z etc).
Code then runs on the original workbook, sampling through
cols H:J and copying records to the new workbook,
such that all records tagged 'A' end up in newbook
sheet name 'A' etc, etc.
This code also copies any values in cols "H:J".

What I would like to do is to crosscheck the number of
records tagged 'A' (or whatever) in the original book, with
the records found in newbook(sheetA) or whatever.

It seems to me that I could use the values in 'mstrList' to
count each instance of each value in cols "H:J" in the
original book, and then do the same in the new book.

If so, then how could I achieve this, and also compare
and alert if there is a problem, please?

Regards.



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 01/09/2003




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Check no. of records have copied correctly

Many thanks.

Regards.

"Tom Ogilvy" wrote in message
...
set srcSh = Worksheets("Whatever") ' sheet with original H:I data
for i = 0 to frmName_Contractors.lbDataCode.Listcount-1
sName = frmName_Contractors.lbDataCode.List(i,0)
num = Application.Countif(srcSh.Range("H1:J50"),sName)
set sh = Workbooks("otherbook.xls").Worksheets(sName)
if sh.cells(rows.count,1).end(xlup).Row < num then
msgbox "Problems"
' if you have header rows in the sheet, adjust the comparison
' to account for these
end if
Next

or

for each itm in mstrList
sName = itm
num = Application.Countif(srcSh.Range("H1:J50"),sName)
set sh = Workbooks("otherbook.xls").Worksheets(sName)
if sh.cells(rows.count,1).end(xlup).Row < num then
msgbox "Problems"
' if you have header rows in the sheet, adjust the comparison
' to account for these
end if
Next


--
Regards,
Tom Ogilvy


Stuart wrote in message
...
If anyone could help with this. it would be much appreciated:

User's workbook has sheets with data in cols A:G
They 'mark' the rows to be copied with a capital letter in
either col H, I, or J. So if row 50 had 'A' in col H and
'K' in col J, then user wishes to send that record to
Clients 'A' and 'K'.
A Collection (mstrList) is built, containing the unique values
found in cols H:J and the values are then loaded into a
multicolumn listbox in a form:
' Add the sorted, non-duplicated items to a ListBox
For Each Item In mstrList
frmName_Contractors.lbDataCode.AddItem Item
Next Item
The user can now enter the true Client name against the
relevenr record identifier ( A, B, Z etc).
A new workbook is created, containing only worksheets
in 'mstrList' and named accordingly (A, B, Z etc).
Code then runs on the original workbook, sampling through
cols H:J and copying records to the new workbook,
such that all records tagged 'A' end up in newbook
sheet name 'A' etc, etc.
This code also copies any values in cols "H:J".

What I would like to do is to crosscheck the number of
records tagged 'A' (or whatever) in the original book, with
the records found in newbook(sheetA) or whatever.

It seems to me that I could use the values in 'mstrList' to
count each instance of each value in cols "H:J" in the
original book, and then do the same in the new book.

If so, then how could I achieve this, and also compare
and alert if there is a problem, please?

Regards.



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 01/09/2003






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 01/09/2003


Reply
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
copied info for chart does not show date correctly Meenie Charts and Charting in Excel 0 July 29th 09 02:30 PM
Delete records when certain records have duplicate column data JVroom New Users to Excel 1 January 26th 09 06:23 PM
Copied formula produces unexpected copied results Robert New Users to Excel 1 December 5th 08 04:11 PM
Check if Conditional Format is True or False / Check cell Color Kevin McCartney Excel Worksheet Functions 5 June 29th 07 11:12 AM
Check and Remove Records Madasamy Excel Discussion (Misc queries) 3 May 5th 06 01:49 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"