Copy fitered/visibel cells (from c13 visibel last value) from sheet (DataFilter)
Copyed data paste to sheet1 c3 to end
Exampel c3 is user name copy that go to sheet archiver and find user name and select user detailed info Range("O85:AU85").Copy go back sheet archiver and past next to user name
Then loop to c4 c5 etc
I tryed sorry for my por English
Thank you
Need help excel macro loop

please can anyone help me
here is the code that i recorded
Sub ddd()
Sheets("sheet1").Range("A3:tt100").ClearContents
Sheets("DataFilter").Select
Range("C13:c99999").Copy
Sheets("Sheet1").Select
Range("C3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Archiveren").Select
Cells.Find(What:=Range("c4").Value, After:=ActiveCell, LookIn:=xlFormulas2, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Range("O85:AU85").Copy _
Destination:=Worksheets("Sheet1").Range("D3")
Sheets("Sheet1").Select
End Sub
how to loop it? optimize
2 answers
Sort by: Most helpful
-
Armen 1 Reputation point
2022-11-17T23:22:36.187+00:00 -
Oskar Shon 866 Reputation points MVP
2022-11-18T14:51:53.87+00:00 You use recorder. That is a good for start, but that method has a lots of unnecessary commends like select/selections and do not use many ways to do job properly and fast.
Buy a book. Really - make a day for your self. You'll have new experience with that. You can going back to examples, make add lines, use markers for interesting code etc.
That is a very good way to understand how it works.Read about loop like:
Do until
or
Do while
and
Object variables (that 'll good for .find commend)You can use For the best loop ever with condition too.
You can use arrays to count in memory not only in cells.Regards