Forum Discussion
Using VBA to move a range of data to a different sheet when complete (need the for dummies version)
HansVogelaar https://docs.google.com/spreadsheets/d/1a0Pfj0Msj6X03atXb-wYZnRB0yBuK_Nt/edit?usp=sharing&ouid=114916416459283258686&rtpof=true&sd=true
You'll have to share the workbook - I now get Access Denied.
- HansVogelaarMay 06, 2022MVP
Thanks, that worked.
You copied the macro into a worksheet module. It should be in a standard module, created by selecting Insert > Module in the Visual Basic Editor.
You used COMPLETEDITEMS in the code, but the sheet is named COMPLETED ITEMS (with a space).
I changed the macro slightly so that you don't have to select a range. It now moves all rows with "x" in column E.
See the attached version.
- cak980Jun 06, 2022Copper ContributorHans - I've made some changes to my worksheet but the macro doesn't work now. I get the message "ambiguous name detected". Also, I tried copying the macro you created to a different worksheet and when I did that, it would always open the original file as well. This was before I was getting the error message. Can you help? Thanks!
- HansVogelaarJun 06, 2022MVP
Do you have two copies of the macro in the same workbook? If so, delete one of them.
If you use the command button:
Right-click it and select Assign Macro... from the context menu.
Select the macro in the active workbook, then click OK.
- cak980Jun 07, 2022Copper Contributor
HansVogelaar Now it's disappeared all together. Can I send it back to you?
- HansVogelaarJun 07, 2022MVP
Sure, go ahead.
- HansVogelaarJun 07, 2022MVP
Here is the workbook with the original macro, I haven't check whether it needs to be updated.
To view the macro, press Alt+F11 to activate the Visual Basic Editor.
- cak980Jun 07, 2022Copper ContributorThank you! It starts at row 7 instead of 6 (first row). What's the edit to change that?
- HansVogelaarJun 08, 2022MVP
Don't you mean "It starts at row 6 instead of 7 (first row)"?
If so, change the line
For s = m To 7 Step -1
to
For s = m To 6 Step -1