Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Comparing Cell values in two sheets within the same workbook
This is the code i have.
i want to compare a range of values in column H in sheet 1 with a column that is in the sheet called 'mis tool' I have the code looping down the range in sheet 1 and comparing to the 1st value in sheet 'mis tool', once the range in sheet 1 has run throught, the cell selected in 'mis tool' will move down 1 and then it will re-check for similar values. the problem i have is that i can't get the code to pick up on entries that are equal to each other. I need an if statement that can compare the selected cell in sheet 1 with the selected cell in sheet 'mis tool', all cells are numerical entries the code as it is stops at the first IF statement, but otherwise does what i need it to do. any ideas? Sub Macro1() Sheets("Sheet1").Select Range("H2").Select Sheets("mis tool").Select Range("F2").Select Sheets("Sheet1").Select Do Do While ActiveCell < 0 If ActiveCell = Sheets("mis tool").ActiveCell Then Sheets("mis tool").Select ActiveCell.Offset(0, 3).Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select ActiveCell.Offset(0, 13).Select ActiveSheet.Paste ElseIf ActiveCell < Sheets("mis tool").ActiveCell Then Sheets("Sheet1").Select ActiveCell.Offset(1, 0).Select End If Loop If ActiveCell = 0 Then Sheets("Sheet1").Select Range("H2").Select Sheets("mis tool").Select ActiveCell.Offset(1, 0).Select End If Loop Until ActiveCell = 0 End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
comparing values from one workbook with another workbook | Excel Discussion (Misc queries) | |||
comparing values on different sheets and deleting | Excel Discussion (Misc queries) | |||
Comparing data in two sheets with similar values | Excel Worksheet Functions | |||
comparing 2 similar columns on seperate work sheets in 1 workbook | Excel Discussion (Misc queries) | |||
Comparing cell values | Excel Programming |