Jed Shields
Active Member
- Joined
- Sep 7, 2011
- Messages
- 283
- Office Version
- 365
- Platform
- Windows
Hi guys,
I've got a few answers from another thread, but I need some further help, plus I didn't want to hijack that thread:
http://www.mrexcel.com/forum/showthread.php?p=2855000#post2855000
I've got list of users that is currently around 10,000 lines, of which around 1500 are unique. I need to copy a list of the unique names to a number of different sheets. The first part that copies the unique list to the current sheet works fine:
Sub EasySol()
Dim LR As Long
LR = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
Range("A1:A" & LR).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("L1"), Unique:=True
End Sub
Sub EasySol2()
Dim ULR As Long
ULR = ActiveSheet.Cells(Rows.Count, "L").End(xlUp).Row
Range("L1:L" & ULR).Select
Selection.Copy
Rem Sheets("Sheet2").Select
Range("m1:m" & ULR).Select
ActiveSheet.Paste
Rem Sheets("Sheet3").Select
Range("n1").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("A1").Select
End Sub
I've rem'd the sheet change code out as this is where it falls over. When I run this code it copies the unique list to rows L, M and N in the same sheet. I've also played around with the range where the unique list goes ie:
Range("L1:L" & ULR).Select
&
Range("n1").Select
Both appear to work okay.
The trouble I'm having is trying to copy the list to Sheet2!M1 and Sheet3!N1. I keep getting errors.
Any ideas?
I'm also looking for a bit of code that will copy a lookup formula in the row next to the unique list ... however, I need to sort the different sheets part out first
Cheers,
Jed.
I've got a few answers from another thread, but I need some further help, plus I didn't want to hijack that thread:
http://www.mrexcel.com/forum/showthread.php?p=2855000#post2855000
I've got list of users that is currently around 10,000 lines, of which around 1500 are unique. I need to copy a list of the unique names to a number of different sheets. The first part that copies the unique list to the current sheet works fine:
Sub EasySol()
Dim LR As Long
LR = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
Range("A1:A" & LR).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("L1"), Unique:=True
End Sub
Sub EasySol2()
Dim ULR As Long
ULR = ActiveSheet.Cells(Rows.Count, "L").End(xlUp).Row
Range("L1:L" & ULR).Select
Selection.Copy
Rem Sheets("Sheet2").Select
Range("m1:m" & ULR).Select
ActiveSheet.Paste
Rem Sheets("Sheet3").Select
Range("n1").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("A1").Select
End Sub
I've rem'd the sheet change code out as this is where it falls over. When I run this code it copies the unique list to rows L, M and N in the same sheet. I've also played around with the range where the unique list goes ie:
Range("L1:L" & ULR).Select
&
Range("n1").Select
Both appear to work okay.
The trouble I'm having is trying to copy the list to Sheet2!M1 and Sheet3!N1. I keep getting errors.
Any ideas?
I'm also looking for a bit of code that will copy a lookup formula in the row next to the unique list ... however, I need to sort the different sheets part out first
Cheers,
Jed.