Matching Colums & Rows in Different Spreadsheets
Hello again,
I need to compare a cell from one spreadsheet to another. Then if they match, copy information from the 1st spreadsheets column to the second spreadsheets row. I have this: With Sheets("Mississippi") lastCol = .Cells(1, "IV").End(xlToLeft).Column For i = lastCol To 1 Step -1 If Len(Trim(.Cells(1, i))) < 0 Then If Application.CountIf(Workbooks("Employee List for Payroll1") _ .Worksheets("List").Columns(6), .Cells(1, i)) = 0 Then .Columns(i).Delete .Columns(i + 1).Delete .Columns(i + 1).Delete .Columns(i).Delete ElseIf Application.CountIf(Workbooks("Employee List for Payroll1") _ .Worksheets("List").Columns(6), .Cells(1, i)) 0 Then Range(Cells(2, i), Cells(200, i + 1)).Select Selection.Delete xlShiftToLeft Range(Cells(1, i + 1), Cells(1, i + 2)).Select Selection.Delete xlShiftToLeft End If End If Next End With This works well at comparing, but does not tell me what the row is on the second sheet so I can copy info to it. It just keeps track of which row I am on, on the first and allows me to manipulate an entire row. Any help would be appreciated. Thanks. |
All times are GMT +1. The time now is 09:51 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com