The Great SrH
Board Regular
- Joined
- Jan 16, 2015
- Messages
- 179
Hi guys,
I'm hoping somebody can help me with a code I need. I've attempted it below but it doesn't work, and it's probably completely wrong!
I have a worksheet called "Form" where the user will input data on a row by row basis. The maximum entries they can put on the sheet are 15 (15 rows) and the first row is A3-I3 (last row A17-I17).
I then have 2 replica worksheets which i want the code to output to - one called DFU and the other PeopleSoft.
I need the code to go down the "Form" worksheet and if Column B's content equals DFU, it will move that row to the "DFU" worksheet. If Column B equals PeopleSoft, it will move that row to the "PeopleSoft" worksheet.
When moving to the other worksheet, i need it to find the first available row in the range A3-I17.
Thanks for any help you can provide!
I'm hoping somebody can help me with a code I need. I've attempted it below but it doesn't work, and it's probably completely wrong!
I have a worksheet called "Form" where the user will input data on a row by row basis. The maximum entries they can put on the sheet are 15 (15 rows) and the first row is A3-I3 (last row A17-I17).
I then have 2 replica worksheets which i want the code to output to - one called DFU and the other PeopleSoft.
I need the code to go down the "Form" worksheet and if Column B's content equals DFU, it will move that row to the "DFU" worksheet. If Column B equals PeopleSoft, it will move that row to the "PeopleSoft" worksheet.
When moving to the other worksheet, i need it to find the first available row in the range A3-I17.
Thanks for any help you can provide!
Code:
Sub test2()
Dim LR As Long, i As Long
With Sheets("Form")
LR = .Range("A17" & Rows.Count).End(xlUp).row
For i = 1 To LR
If .Range("B" & i).Value = "DFU" Then
.Range("A:I" & i).Copy
Sheets("DFU").Range("A3:A17" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
End If
Next i
End With
End Sub
Last edited: