Hello,
Sorry if this post has already been written before but I am very new to Macros and am having trouble finding a code that works the way I would like it. So I have a payroll report that I run all the time and I ran a simple macro to get the formatting down to which columns I need but I am trying to also have the Macro add a blank row when the data changes in columns C, G, and M. One other thing, row 1 of my data is the title of each column and I do not want to add a blank line between the title of each column and the first of my data. So for column C, it is expense type of Salary or Fringe. I just want a blank row to be added when a row changes from Salary to Fringe or from Fringe to Salary. For column G, it is the account number. Same thing, I would like to add a blank row when there is a change from one account to another. And column M is employee name. Anytime there is a change in the employees name, I would like a blank row to be added.
One last thing, is it possible to write the code to only add a blank row when there is a change in data and not from another blank row? I worry that if there is a code to add a blank row when there is a change from Salary to Fringe, it will add another blank line when the next columns code is looking through the change in account numbers. And once again when the code is looking for a change in employee names. I hope that makes sense. Attached is mock version of the file I am working on. If you look at the attachment, I would like the code to add the blank rows like I have done. Column G and Column M both had a change in data but only one blank row is added. The next blank row that is added is for the name change in Column M.
Any help would be appreciated. I will do my best to answer any questions but I am not the most tech savvy.
Sorry if this post has already been written before but I am very new to Macros and am having trouble finding a code that works the way I would like it. So I have a payroll report that I run all the time and I ran a simple macro to get the formatting down to which columns I need but I am trying to also have the Macro add a blank row when the data changes in columns C, G, and M. One other thing, row 1 of my data is the title of each column and I do not want to add a blank line between the title of each column and the first of my data. So for column C, it is expense type of Salary or Fringe. I just want a blank row to be added when a row changes from Salary to Fringe or from Fringe to Salary. For column G, it is the account number. Same thing, I would like to add a blank row when there is a change from one account to another. And column M is employee name. Anytime there is a change in the employees name, I would like a blank row to be added.
One last thing, is it possible to write the code to only add a blank row when there is a change in data and not from another blank row? I worry that if there is a code to add a blank row when there is a change from Salary to Fringe, it will add another blank line when the next columns code is looking through the change in account numbers. And once again when the code is looking for a change in employee names. I hope that makes sense. Attached is mock version of the file I am working on. If you look at the attachment, I would like the code to add the blank rows like I have done. Column G and Column M both had a change in data but only one blank row is added. The next blank row that is added is for the name change in Column M.
Any help would be appreciated. I will do my best to answer any questions but I am not the most tech savvy.