Hi All,
I have the following code that runs well.
What I would like to do is have this code run through rows 1:200 on Sheet1 and run the code on each line, I'm sure I could copy and paste this code 200 times changing the Range each time, but there has to be an easier way
Thanks in advance for your replies,
Simon
I have the following code that runs well.
Code:
Sub matchEm()
Sheets("Timesheet Log").Unprotect "ops9999"
Application.Screenupdating = False
Dim vRow, vColumn
Dim sht1 As Excel.Worksheet
Dim sht2 As Excel.Worksheet
Set sht1 = Sheets("Sheet1")
Set sht2 = Sheets("Timesheet Log")
vRow = Application.Match(sht1.Range("A2").Value, sht2.Range("B:B"), 0)
If Not IsError(vRow) Then
vColumn = Application.Match(sht1.Range("B4").Value2, sht2.Range("2:2"), 0)
If Not IsError(vColumn) Then sht2.Cells(vRow, vColumn).Resize(5).Value = Application.Transpose(sht1.Range("G2:K2").Value)
End If
Sheets("Timesheet Log").Protect "ops9999", True, True
Application.Screenupdating = True
End Sub
What I would like to do is have this code run through rows 1:200 on Sheet1 and run the code on each line, I'm sure I could copy and paste this code 200 times changing the Range each time, but there has to be an easier way
Thanks in advance for your replies,
Simon