Repeating a simple macro loop up to 1,500 times
Solved/Closed
shassall
Posts
2
Registration date
Monday July 17, 2017
Status
Member
Last seen
July 18, 2017
-
Updated on Jul 18, 2017 at 02:40 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Jul 20, 2017 at 11:29 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Jul 20, 2017 at 11:29 AM
Related:
- Repeating a simple macro loop up to 1,500 times
- Times attack - Download - Children
- Simple diagram of hard disk - Guide
- Game loop - Download - Android emulators
- Fruity loop download - Download - Musical production
- Spell number in excel without macro - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Jul 18, 2017 at 11:47 AM
Jul 18, 2017 at 11:47 AM
Hi Steve,
The code below will transpose your grouped data to columns B:E. You can then manually delete column A, to shift all data to the left. Or you can remove the apostrophe in front of code line 11 to let the code remove it for you.
Here is the code:
Hopefully this will get you excited again!
Best regards,
Trowa
The code below will transpose your grouped data to columns B:E. You can then manually delete column A, to shift all data to the left. Or you can remove the apostrophe in front of code line 11 to let the code remove it for you.
Here is the code:
Sub RunMe() Dim x, y As Integer x = 1 y = 1 Do Range(Cells(x, "A"), Cells(x + 3, "A")).Copy Range("B" & y).PasteSpecial Transpose:=True x = x + 5 y = y + 1 Loop Until Cells(x, "A") = vbNullString 'Columns("A").Delete Application.CutCopyMode = False End Sub
Hopefully this will get you excited again!
Best regards,
Trowa
Jul 18, 2017 at 07:01 PM
WOW! I am sure I would not have known how to do this, so thank you very much for your quick response. I will try it tonight and report back....
I'll assume rhetorically, that I should create a macro and paste this code into it? If I get stuck, I'll ask another question.
Thanks!
Steve
Jul 20, 2017 at 11:07 AM
In case you get stuck on that:
How to implement and run a code:
- From Excel hit Alt + F11 to open the “Microsoft Visual Basic” window.
- Go to the top menu in the newly opened window > Insert > Module.
- Paste the code in the big white field.
- You can now close this window.
- Back at Excel, hit Alt + F8 to display the available macro’s.
- Double-click the macro you wish to run.
NOTE: macro’s cannot be reversed using the blue arrows. Always make sure you save your file (or create a back up to be entirely sure) before running a code, so you can re-open your file if something unforeseen happens or you want to go back to the situation before the code was run.
Jul 20, 2017 at 11:17 AM
I opened the existing macro that I had created to run four manual loops and overwrote that code with your macro. It worked perfectly!!!! (Of course you knew that! :-)
Thank you so much, I couldn't have figured this out without your help...and I'm somewhat of an Excel guru...just not a macro guru!
Steve
Jul 20, 2017 at 11:29 AM
And be careful, before you know it you are sucked into the world of macro's!!! ;)