Results 1 to 3 of 3

Thread: Macro To Insert Columns In Excel

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    1
    Rep Power
    0

    Macro To Insert Columns In Excel

    I'm seeking a macro to insert a column to the right of columns C:N and R:W.

    Thank you in advance for your help.

  2. #2
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    To the right of each column from C:N and R:W, or just one column to the right of R:W and C:N?
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  3. #3
    Member
    Join Date
    Nov 2011
    Posts
    41
    Rep Power
    0
    Try this One..
    Code:
    Public Sub InsertColumns()
        
        Dim intCol As Integer
    
        Const strCol = "N:N" 'Here Just add the last Columns charactor Like "C:N"'s - N:N
        Const strSheetName = "Sheet1" ''Here just add the sheet Name
        Const intTotal = 5 'Here Pass the number of columns that you want to add
        
        With ThisWorkbook.Worksheets(strSheetName)
            For intCol = 1 To intTotal
                .Columns(strCol).Insert xlRight
            Next
        End With
        
    End Sub


    Regards
    Prince

Similar Threads

  1. Replies: 3
    Last Post: 06-01-2013, 11:31 AM
  2. Macro to copy data in specific Columns
    By Howardc in forum Excel Help
    Replies: 0
    Last Post: 04-19-2013, 10:42 AM
  3. Macro Copy Columns and Paste in rows.
    By TommyKris in forum Excel Help
    Replies: 3
    Last Post: 03-06-2013, 02:36 PM
  4. Validating 2 Columns using excel VBA
    By freakszzy in forum Excel Help
    Replies: 2
    Last Post: 07-26-2012, 12:46 PM
  5. help with after insert event in Access 10
    By richlyn in forum Access Help
    Replies: 9
    Last Post: 03-03-2012, 10:49 PM

Posting Permissions

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