Results 1 to 5 of 5

Inserting a new column in another sheet

Threaded View

  1. #1
    Registered User
    Join Date
    12-07-2006
    Posts
    36

    Inserting a new column in another sheet

    Hi.
    I have some code which runs by clicking a button in Sheet1.
    I want the code to insert a new column in Sheet2 (using a variable 'colNo', which holds the column insert location as a number.)

    I thought the following piece of code would do this okay:

    Dim colNo As Long
    colNo = 2
    
    Sheets("Sheet2").Select
    Columns(colNo).Select
    Selection.Insert Shift:=xlToRight
    . . . but it doesn't work.
    I keep getting a '1004' error(?)

    Does anyone know how to do this correctly?

    Thanks in advance for your help.
    Last edited by VBA Noob; 01-14-2009 at 01:39 PM.

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