Trying to see if I can even create a Macro! Please help!
Closed
almacgtz
RayH - Jan 21, 2015 at 03:57 PM
- Posts
- 2
- Registration date
- Friday January 16, 2015
- Status
- Member
- Last seen
- January 21, 2015
RayH - Jan 21, 2015 at 03:57 PM
Related:
- Trying to see if I can even create a Macro! Please help!
- How to create a macro to copy data from another workbook - Guide
- How to create a macro in excel to copy and paste - Guide
- Create a macro ✓ - Forum - Excel
- Creating a Macro to Find Text and Then Merge Cells ✓ - Forum - Excel
- Create a macro to format a column ✓ - Forum - Excel
1 reply
Give this a go.
Sub copystudents()
Let LastRowH = Range("H" & Rows.Count).End(xlUp).Row
Let LastRowA = Range("A" & Rows.Count).End(xlUp).Row
For Each c In Range("H3:H" & LastRowH)
On Error GoTo notfound
x = Rows(Application.Match(c.Value, Range("A1:A" & LastRowA), 0)).Row
Range(c.Address & ":L" & c.Row).Copy Destination:=Range("A" & x & ":E" & x)
notfound:
Next
End Sub
Jan 21, 2015 at 11:55 AM
The code worked perfectly fine; however, if a student number is already on the left side is there any way to highlight the information on the right side without replacing the information on the left side.
Best regards,
Alma Gtz
Jan 21, 2015 at 03:57 PM
I am highlighting in red where the value on the right is not found.
For any others the colors stay as they are.