I left out one line that increments rowcount. see code below
Sub move_data()
Const Grss_Comp_Col = "F"
Const Grss_Comp_Row = 20
With Sheets("WorksheetA")
StartCol = .Range("E1").Column
ColCount = StartCol
Do While .Cells(1, ColCount) < "TOTAL"
MyName = .Cells(1, ColCount)
LastName = Trim(Left(MyName, InStr(MyName, ",") - 1))
FirstName = Trim(Mid(MyName, InStr(MyName, ",") + 1))
If InStr(FirstName, " ") 0 Then
MiddleName = Trim(Mid(FirstName, InStr(FirstName, " ") + 1))
FirstName = Trim(Left(FirstName, InStr(FirstName, " ") - 1))
Else
MiddleName = ""
End If
Gross = .Cells(Grss_Comp_Row, ColCount).Offset(0, 2)
With Sheets("WorksheetB")
StartRow = 7
RowCount = StartRow
Found = False
Do While .Range("A" & RowCount) < ""
FirstN = .Range("C" & RowCount)
MiddleN = .Range("D" & RowCount)
LastN = .Range("B" & RowCount)
If FirstName = FirstN And _
MiddleName = MiddleN And _
LastName = LastN Then
.Range("F" & RowCount) = Gross
Found = True
Exit Do
End If
RowCount = RowCount + 1
Loop
If Found = False Then
MsgBox ("Did not find: " & FirstName & MiddleName & LastName)
End If
End With
ColCount = ColCount + 4
Loop
End With
End Sub
"Joel" wrote:
It woulde be a lot siomplier if you had SS# on worksheet A. Here is the
start of the code.
Sub move_data()
Const Grss_Comp_Col = "F"
Const Grss_Comp_Row = 20
With Sheets("WorksheetA")
StartCol = .Range("E1").Column
ColCount = StartCol
Do While .Cells(1, ColCount) < "TOTAL"
MyName = .Cells(1, ColCount)
LastName = Trim(Left(MyName, InStr(MyName, ",") - 1))
FirstName = Trim(Mid(MyName, InStr(MyName, ",") + 1))
If InStr(FirstName, " ") 0 Then
MiddleName = Trim(Mid(FirstName, InStr(FirstName, " ") + 1))
FirstName = Trim(Left(FirstName, InStr(FirstName, " ") - 1))
Else
MiddleName = ""
End If
Gross = .Cells(Grss_Comp_Row, ColCount).Offset(0, 2)
With Sheets("WorksheetB")
StartRow = 7
RowCount = StartRow
Found = False
Do While .Range("A" & RowCount) < ""
FirstN = .Range("C" & RowCount)
MiddleN = .Range("D" & RowCount)
LastN = .Range("B" & RowCount)
If FirstName = FirstN And _
MiddleName = MiddleN And _
LastName = LastN Then
.Range("F" & RowCount) = Gross
Found = True
Exit Do
End If
Loop
If Found = False Then
MsgBox ("Did not find: " & FirstName & MiddleName & LastName)
End If
End With
ColCount = ColCount + 4
Loop
End With
End Sub
"Kevin Porter" wrote:
Hello,
WorksheetA (http://www.specialty-risk.com/Spread...WorksheetA.xls)
is the worksheet created by QuickBooks.
WorksheetB (http://www.specialty-risk.com/Spread...WorksheetB.xls)
is a worksheet I use to keep track of monthly info, I also update the SS#
and names field manually for now.
WorksheetC (http://www.specialty-risk.com/Spread...WorksheetC.xls)
is the worksheet required for upload to our 401k company.
I would like to match a name/SS# on WorksheetA with the name on WorksheetB,
update the fields on WorksheetB, then copy that info to WorksheetC. I can
move info from WorksheetB to WorksheetC, I need help going from WorksheetA to
WorksheetB.
Please any help would be appreciated. Let me know if their are any other
questions.
Thanks,
Kevin Porter