Insert columns into worksheet (VBA?)

lawi227

Board Regular
Joined
Mar 17, 2016
Messages
123
I have a workbook that I am creating that does an analysis. The analysis can be done for 1 or 2 companies.

Rather than making changes manually (like adding columns to a worksheet), I would like to be able to type "1" or "2" in to a cell and have a code linked to that cell that will do the changes I need. This text box is located in cell E3 on a tab called "Instructions".

The first change I need is to add two columns to a worksheet.

When "2" is typed in to E3 on the "Instructions" tab, I need to duplicate columns I, J, K, L and paste them right after column L. Note: there is information in column M:Q. Below is an example of what my worksheet looks like (row 1 is the column letters, row 2 is the header names, row 3 is example data):
HIJKLMNOPQ
DescriptionNotesDepthBreadthImpactScoreRankGapAvg.Bucket
TEXT TEXT TEXTTEXT TEXT3215423A

<tbody>
</tbody>

I need the new table to look like this:

HIJKLMNOPQR
DescriptionNotesDepthBreadthImpactScoreNotes 2Depth 2Breadth 2Impact 2Score 2

<tbody>
</tbody>


Thanks!
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I looked at this but do not understand your examples. In your first example in row 2 you show Text Text Text
But in your second example you show: 2 2 2 2
 
Upvote 0
Row 1 of each table is the column.
Row 2 is the headers.
Row 3 is example data. "TEXT TEXT TEXT" means that it's just a string of words - not numbers.

In my new table example, I am trying to differentiate the headers. For example, I would need a header called "Notes" in Column I, and I would need another header called "Notes 2" in Column N.

Sorry I'm not very good at posting my tables into this forum. Still a beginner user of the forum..
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

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