Hi all,
Trying to be resourceful by using code from other posts to move rows from one "parent" sheet to various other sheets, unfortunately making alterations is not as intuitive as I had thought. If I could get some help deciphering this code, I think I could solve my problem and hopefully get better with VBA at the same time:
This is my altered version of some code I copied from a post from late 2017, called "Macro to move rows from one sheet to another based on cell value" (I can't post links )
Please Login or Register to view this content.
My understanding of what each line does:
1. Names this action as moverows, because that is the objective. Not sure if the empty parentheses are required.
2. "Creates" 3 worksheets, named wi, wp, and wn.
3. "Creates"3 variables, names i, p, and n. Not sure what "R As Range" is doing.
4. Ties the worksheets created in step 2 to the names of the sheets in my workbook. Why are there colons here instead of commas like everywhere else?
5. Not sure. What does the "B" signify? What does xlUp mean? What does "Row To 2 Step - 1" do?
6. In worksheet wi/"Raw", looks for "AABB" in row 1, column 7. I understand how if statements work.
7. Selects cell in row 1 column 1. Not sure about the rest. Somehow it is getting pasted in worksheet wp/"AABB".
8. Deletes the empty row from worksheet wi/"Raw". I know "Shift:=xlUp" is moving the other rows up, but please clarify the inputs.
9. In worksheet wi/"Raw", looks for "A1" in row 1, column 7.
10. Seems similar to step 7, but wi.Rows has replaced wi.Cells and there is no Resize? This part is not working properly.
11. Not sure what this does. A bit confusing because I copied it from another person's project. I just need steps 9 - 12 to replicate the actions taken by steps 6-8.
12. Same as step 9.
13. Repeats steps 1-12 for the next row.
Please clarify whatever you can even if it only one row! All responses are appreciated Also if you have any corrections to my terminology don't hesitate to let me know, I'm (obviously) not fluent in VBA.
Bookmarks