Vba - insert two columns after each occurrence of dept name

aattwod

New Member
Joined
Mar 13, 2009
Messages
8
Office Version
  1. 2016
Platform
  1. Windows
I need help with simple VBA Code. I have a SAP BW Excel Extract. In Row 3 there are are column headers of ten Depts. Each Dept's name occurs four times. I want to find the last occurrence of each Dept's name and insert two blank columns for each Dept. All the first blank column's header must be "Reasons for Variance" and the second must be "Corrective Action". Can someone help please.
 
Just use the _v3 code and try adjusting the red numbers below. Certainly the last one should be -6 but see if you can determine the other changes required.
Rich (BB code):
For c = Cells(3, Columns.Count).End(xlToLeft).Column + 1 To 8 Step -7
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,215,507
Messages
6,125,212
Members
449,214
Latest member
mr_ordinaryboy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top