+ Reply to Thread
Results 1 to 6 of 6

Macros - adding columns and deleting columns

  1. #1
    Registered User
    Join Date
    10-19-2012
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    23

    Macros - adding columns and deleting columns

    Hi, I am new to this forum and fairly new to macros in Excel 2010. I am trying to create a macro to do the following:

    - Delete column C
    - add 2 new columns (between E & F and between G & H)
    - Change the font for the entire worksheet

    So far the only part that I can get to work is the font change. When I try to delete the column, the entire spreadsheet contents disappears. (I am selecting the column by clicking on column E, then I select from Home tab, the Cells group, the Delete icon.)

    When I attempt to insert the 2 columns (home tab, Cells group, Insert cells with column F selected) It moves the entire spreadsheet over to column K.

    Any help would be greatly appreciated!!

  2. #2
    Forum Contributor
    Join Date
    03-15-2007
    Location
    AL, USA
    MS-Off Ver
    2007
    Posts
    174

    Re: Macros - adding columns and deleting columns

    Please post the code that you have. Remember to use the code tags - it's the one that looks like the pound/hash symbol (#).

  3. #3
    Registered User
    Join Date
    10-19-2012
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Macros - adding columns and deleting columns

    Is this what you were asking for?

    Please Login or Register  to view this content.
    Last edited by arlu1201; 04-22-2013 at 07:59 AM.

  4. #4
    Forum Contributor
    Join Date
    03-15-2007
    Location
    AL, USA
    MS-Off Ver
    2007
    Posts
    174

    Re: Macros - adding columns and deleting columns

    Well, you got half of what I wanted :P. When you post code in the future, click the # button right above where you type your post, then paste your code between those tags.

    I see no flaw in your code. For me, it does what you want it to do. All I did was clean it up a bit:
    Please Login or Register  to view this content.
    Last edited by mshale; 10-19-2012 at 04:19 PM.

  5. #5
    Registered User
    Join Date
    10-19-2012
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Macros - adding columns and deleting columns

    I'm not sure what you did, but it works now. Many, many thanks to you!!!!!!

  6. #6
    Registered User
    Join Date
    04-22-2013
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Macros - adding columns and deleting columns

    Hi

    just wanted to add to this thread in case anyone else has the same problem as the OP, like I did - I was using a macro to delete a single column but it was deleting all data in the worksheet. I discovered that for some reason, all of the cells on the sheet were merged, even though it didn't look as if they were. Maybe it was because the spreadsheet I was using was directly exported from a web application, which I suspect had something to do with it. Anyway, starting the macro by selecting all cells and un-merging solved it for me
    .
    carter

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1