+ Reply to Thread
Results 1 to 2 of 2

Using VBA to create column header

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-01-2009
    Location
    Maine, USA
    MS-Off Ver
    Excel 2016
    Posts
    161

    Using VBA to create column header

    I've created some columns using this code:

    Private Sub AddNameColumns()
        With Sheets("ModifiedData")
            Columns("B:D").Select
            Selection.Insert Shift:=xlToRight
            Columns("N:P").Select
            Selection.Insert Shift:=xlToRight
        End With
    End Sub
    I'd like to put values (or column headers) into B1, C1, D1, N1, O1, and P1.

  2. #2
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2007, 2010
    Posts
    470

    Re: Using VBA to create column header

    try add some code lines, like this:

    Private Sub AddNameColumns()
        With Sheets("ModifiedData")
            Columns("B:D").Insert Shift:=xlToRight
            Columns("N:P").Insert Shift:=xlToRight
             .Range("B1:D1")=1
             .Range("N1:P1")="Example"
        End With
    End Sub

+ 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