LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Compare cell content from two worksheets

I am importing two separate excel files into a master file that has macros
performing multiple tasks. There is a chance that the operator can select the
wrong second file to import. I want to compare two cells in each of the two
worksheets to determine if they are equal. The first file will be copied into
the worksheet "Item Charts" the second into worksheet "Wire Charts". I need
to verify that cell A2 in worksheet "Wire Charts" is equal to cell A2 in
worksheet "Item Charts". As you can see, I have tried multiple ways and
continue to fail. Problem starts at line "ActiveCell.FormulaR1C1".
This is what I have:

On Error GoTo errorhandler
Workbooks.Open Filename:=Dir(Application.GetOpenFilename), UpdateLinks:=0
Range("A1").Select
cellcheck = ActiveCell(1, 1)
If cellcheck < "POS NBR" Then
Application.ScreenUpdating = True
MsgBox ("This File " & filetoopenitems & " Does Not Seem to be an
Item Chart, please check the file name and start again")
ActiveWorkbook.Close
ThisWorkbook.Activate
End
End If
Cells.Select
Selection.Copy
Windows("QIC_AM_r06 for GSD.xls").Activate
Sheets("Item Charts").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Cells.Select
Cells.EntireColumn.autofit
Range("A1").Select
Workbooks.Open Filename:=Dir(Application.GetOpenFilename), UpdateLinks:=0
Range("A1").Select
cellcheck = ActiveCell(1, 1)
If cellcheck < "CIRCUIT NBR" Then
Application.ScreenUpdating = True
MsgBox ("This File " & filetoopenitems & " Does Not Seem to be a
Wire Chart, please check the file name and start again")
Dim WkbkName As Object
For Each WkbkName In Application.Workbooks()
If WkbkName.Name < ThisWorkbook.Name Then WkbkName.Close
Next
ThisWorkbook.Activate
Selection.ClearContents
Range("A1").Select
End
End If
Cells.Select
Selection.Copy
Windows("QIC_AM_r06 for GSD.xls").Activate
Sheets("Wire Charts").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Cells.Select
Cells.EntireColumn.autofit
Range("A1").Select
For Each WkbkName In Application.Workbooks()
If WkbkName.Name < ThisWorkbook.Name Then WkbkName.Close
Next

' ActiveCell.FormulaR1C1 = "=IF(R[1]C<'Item Charts'!R[1]C)"
' cellcheck = ActiveCell(2, 1)
' If cellcheck < Worksheets("Item Charts")!Cells("A2") Then
' If Cells("A2") < Worksheets("Item Charts")!Cells("A2") Then
Range("A2").Select
' If Cell.Value < Worksheets("Item Charts").Cells("A2").Value Then
Application.ScreenUpdating = True
MsgBox ("These Files Do Not Seem to be the same harness assembly,
please check the file name and start again")
End
End If

Would appreciate any help, thanks.
--
John S. Walker
 
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
Sort worksheets by cell content R3dD0g Excel Discussion (Misc queries) 5 September 15th 08 07:59 PM
how to compare cell content to a row pf data in excel and return . Abdel Excel Discussion (Misc queries) 0 December 12th 06 09:43 PM
Copy content of cell to another depending on value of third cell(between worksheets) Zeljko Milak Excel Worksheet Functions 2 July 14th 06 07:17 PM
Compare and match names and extract a cell content dexsourcesys Excel Worksheet Functions 1 January 19th 06 07:51 PM
how do i compare 2 spread sheets if the content of a cell is avai. Hayitsme Excel Worksheet Functions 1 December 16th 04 11:27 PM


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

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

About Us

"It's about Microsoft Excel"