View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Kevin Porter Kevin Porter is offline
external usenet poster
 
Posts: 38
Default 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.