How do I make a VBA Macro code to indent cells/paste a specific string everytime?

  Kiến thức lập trình

I am not very experienced at VBA Macro code, and the code that I am trying to accomplish is a little too advanced for me to do haha. Anyways, I am looking to make code using nested if-statements to detect grouped rows and indent those specific lines and one that pastes specific strings in 16 rows.

So I made code that groups rows into 4 groups – a main class, sub class, and a sub of the sub class. I want to make if statements that ungroups the sub of the sub class first, and if that specific row is ungrouped, then it will indent the string value on Column A 3 times. After, it will ungroup the sub class, and if the specific row is ungrouped, then it will indent the string on Column A 2 times. And lastly, the main class will be indented once.

My last question is that I am looking for code that scans the string values on Column A for the word “Total” and then if it finds that row, it will paste string values 2 rows below the row that “Total” is on. I need string values for 16 rows below the 2 rows pasted. So for example, after it finds total, i need a,b,c,d,e… pasted each on separate rows 2 rows underneath total, and I need 16 of them. Thank you so much – I really appreciate all the help 🙂

I have already made the code that groups the rows into 4 groups.

New contributor

migsa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website