Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I generate this in Excel 2007?

enter image description here
enter image description here
enter image description here

I start with component 1, component 2 and component 3 header columns, as shown in the first picture. When they are dragged down, Excel will look like the second picture. My desired final result is shown in the third picture.

I believe this requires scripting, but I'm not really sure. I would really appreciate any ideas on how to do this.

share|improve this question
    
What exactly are you trying to accomplish? Do you want a "script" that automatically inserts those values into your spreadsheet? –  muncherelli Feb 9 '11 at 15:48
    
@muncherelli: That would probably the solution. Is that possible? –  tintincutes Feb 9 '11 at 15:57

1 Answer 1

up vote 1 down vote accepted

Just record a new Macro.

Except taken from: http://office.microsoft.com/en-us/excel-help/create-or-delete-a-macro-HP010014111.aspx

When you record a macro, the macro recorder records all the steps required to complete the actions that you want your macro to perform. Navigation on the Ribbon is not included in the recorded steps.

NOTE The Ribbon is a component of the Microsoft Office Fluent user interface.

If the Developer tab is not available, do the following to display it: Click the Microsoft Office Button , and then click Excel Options. In the Popular category, under Top options for working with Excel, select the Show Developer tab in the Ribbon check box, and then click OK. To set the security level temporarily to enable all macros, do the following: On the Developer tab, in the Code group, click Macro Security.

Under Macro Settings, click Enable all macros (not recommended, potentially dangerous code can run), and then click OK. NOTE To help prevent potentially dangerous code from running, we recommend that you return to any one of the settings that disable all macros after you finish working with macros. For more information about how to change the settings, see Change macro security settings in Excel.

On the Developer tab, in the Code group, click Record Macro. In the Macro name box, enter a name for the macro. NOTE The first character of the macro name must be a letter. Subsequent characters can be letters, numbers, or underscore characters. Spaces cannot be used in a macro name; an underscore character works well as a word separator. If you use a macro name that is also a cell reference, you may get an error message that the macro name is not valid.

To assign a CTRL combination shortcut key to run the macro, in the Shortcut key box, type any lowercase letter or uppercase letter that you want to use. NOTE The shortcut key will override any equivalent default Excel shortcut key while the workbook that contains the macro is open. For a list of CTRL combination shortcut keys that are already assigned in Excel, see Excel shortcut and function keys.

In the Store macro in list, select the workbook where you want to store the macro. TIP If you want a macro to be available whenever you use Excel, select Personal Macro Workbook. When you select Personal Macro Workbook, Excel creates a hidden personal macro workbook (Personal.xlsb) if it does not already exist, and saves the macro in this workbook. In Windows Vista, this workbook is saved in the C:\Users\user name\AppData\Local\Microsoft\Excel\XLStart folder. In Microsoft Windows XP, this workbook is saved in the C:\Documents and Settings\user name\Application Data\Microsoft\Excel\XLStart folder. Workbooks in the XLStart folder are opened automatically whenever Excel starts. If you want a macro in the personal macro workbook to be run automatically in another workbook, you must also save that workbook in the XLStart folder so that both workbooks are opened when Excel starts.

In the Description box, type a description of the macro. Click OK to start recording. Perform the actions that you want to record. On the Developer tab, in the Code group, click Stop Recording . TIP You can also click Stop Recording on the left side of the status bar.

share|improve this answer
    
I will try this solution and will let you know the result thanks:-) Give me 1-2 days please –  tintincutes Feb 9 '11 at 16:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.