This was in a prvious post, but the subject did not do it justice.
I have code that is supposed to find the row with a specified name in it, and find a specified date in a column and put a number at the intersection. Like so:
9/15
Bob 5
If it does not find the exact name or the 9/15 in this case, it is supposed to add them. That works.
But with this code, if finds the name with no problems, but if I were to add another it it looks like this:
9/15 9/15
Bob 5
Jim 7
This is my code to find the name and date and throw in EHOURS at the intersection:
With Worksheets(sWkSht)
lRow = .Range("A65536").End(xlUp).Row
'find name
Set fnd = .Range("A2:A" & lRow).Find(EName, , , Whole, xlByRows, xlNext)
If fnd Is Nothing Then
.Cells(lRow, 1).Offset(1, 0) = EName
IntersectRow = lRow + 1
Else
IntersectRow = fnd.Row
End If
'find date
Set fnd = .Rows(1).Cells.Find(EDate, , , xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False)
If fnd Is Nothing Then '*PROBLEM* fnd always is nothing
.Range("IV1").End(xlToLeft).Offset(0, 1) = EDate
IntersectCol = .Range("IV1").End(xlToLeft).Offset(0, 1).Column
Else
IntersectCol = fnd.Column
End If
'The intersect occurs at
.Cells(IntersectRow, IntersectCol - 1) = EHOURS
End With
How can I have it end up like this
9/15 9/17 9/18
Bob 5 6
Jim 2 3
Bill 8
"We have enough youth, How about a fountain of SMART?
I have code that is supposed to find the row with a specified name in it, and find a specified date in a column and put a number at the intersection. Like so:
9/15
Bob 5
If it does not find the exact name or the 9/15 in this case, it is supposed to add them. That works.
But with this code, if finds the name with no problems, but if I were to add another it it looks like this:
9/15 9/15
Bob 5
Jim 7
This is my code to find the name and date and throw in EHOURS at the intersection:
With Worksheets(sWkSht)
lRow = .Range("A65536").End(xlUp).Row
'find name
Set fnd = .Range("A2:A" & lRow).Find(EName, , , Whole, xlByRows, xlNext)
If fnd Is Nothing Then
.Cells(lRow, 1).Offset(1, 0) = EName
IntersectRow = lRow + 1
Else
IntersectRow = fnd.Row
End If
'find date
Set fnd = .Rows(1).Cells.Find(EDate, , , xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False)
If fnd Is Nothing Then '*PROBLEM* fnd always is nothing
.Range("IV1").End(xlToLeft).Offset(0, 1) = EDate
IntersectCol = .Range("IV1").End(xlToLeft).Offset(0, 1).Column
Else
IntersectCol = fnd.Column
End If
'The intersect occurs at
.Cells(IntersectRow, IntersectCol - 1) = EHOURS
End With
How can I have it end up like this
9/15 9/17 9/18
Bob 5 6
Jim 2 3
Bill 8
"We have enough youth, How about a fountain of SMART?