Hi
As an example, I'm trying to copy cells from columns: B,C,Y and Z for every row where column AB is equal to Y in sheet 1, to the first blank row of another sheet whilst incrementing the number in column A. Can someone help with this please?
Thanks
As an example, I'm trying to copy cells from columns: B,C,Y and Z for every row where column AB is equal to Y in sheet 1, to the first blank row of another sheet whilst incrementing the number in column A. Can someone help with this please?
Thanks
VBA Code:
[/
Private Sub CommandButton1_Click()
Dim lookUpSheet As Worksheet, updateSheet As Worksheet
Dim valueToSearch As String
Dim i As Integer, t As Integer
Set lookUpSheet = Worksheets("Monthly Review Sheet")
Set updateSheet = Worksheets("Sheet2")
If MsgBox("Load records?", vbYesNo) = vbYes Then
lastRowLookup = lookUpSheet.Cells(Rows.Count, "A").End(xlUp).Row
lastRowUpdate = updateSheet.Cells(Rows.Count, "A").End(xlUp).Row
For t = 1 To lastRowLookup
If lookUpSheet.Cells(t, 28) = "Y" Then
updateSheet.Cells(i, 2) = lookUpSheet.Cells(t, 2)
updateSheet.Cells(i, 3) = lookUpSheet.Cells(t, 3)
Exit For
End If
Next t
Application.ScreenUpdating = True
Application.CutCopyMode = False
MsgBox ("Records updated")
End If
End Sub
]