most
Board Regular
- Joined
- Feb 22, 2011
- Messages
- 107
- Office Version
- 365
- 2019
- Platform
- Windows
- Mobile
I need really need some pointers here, what is the best/easiest way to solve this? The code below doesn't work, so many different issues so I'm not sure there are any point for me in pointing them out. =)
For each date in this sheet...
...find the date in this sheet return time and type to the first sheet.
Here they come anyway...
Issue#1 - When date is not found I get and Error13 Type mismatch
Issue#2 - For each day it only returns "In", "Out" seems to be overwritten
For each date in this sheet...

...find the date in this sheet return time and type to the first sheet.

Here they come anyway...
Issue#1 - When date is not found I get and Error13 Type mismatch
Issue#2 - For each day it only returns "In", "Out" seems to be overwritten
Code:
Sub MigrateX()
For Each c In Worksheets("Sheet1").Range("A2:A7").Cells
For Each f In Worksheets("Sheet2").Range("A1:A6").Cells
If DateValue(c.Value) = DateValue(f.Value) Then 'Find the right date
If f.Offset(0, 2).Value = "Out" Then 'Find "out"
c.Offset(0, 1).Value = "Out" 'Apply data
c.Offset(0, 2).Value = f.Offset(0, 1).Value
GoTo NextIteration
Else
'Nothing
End If
If f.Offset(0, 2).Value = "In" Then 'Find "in"
c.Offset(0, 1).Value = "In" 'Apply data
c.Offset(0, 2).Value = f.Offset(0, 1).Value
GoTo NextIteration
Else
'Nothing
End If
Else
End If
Next f
NextIteration:
Next c
End Sub