Hi All,
I am new enough to VBA,
I have a bit of working code that looks at 2 cell values on sheet 1, and matches them on sheet 2, then copies cell values from sheet 1 and pastes them to that location in sheet 2
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("E2").Value2, sht2.Range("2:2"), 0)
If Not IsError(vColumn) Then sht2.Cells(vRow, vColumn).Resize(5).Value = Application.Transpose(sht1.Range("G2:J2").Value)
End If
Sheets("Timesheet Log").Protect "ops9999", True, True
Application.Screenupdating = True
End Sub
I want this code to run through the first 100 lines performing the same task for each line, while I could copy and paste this code replacing the necessary cells, this sounds messy and slow.
If anybody knows any tips or tricks to do this faster and simpler, that would be great
Thanks in advance for any replies
Simon
Bookmarks