Thanks Thanks:  0
Likes Likes:  0
Results 1 to 8 of 8

Thread: code for inserting a column

  1. #1
    New Member
    Join Date
    May 2002
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I would like to make a command button that will insert a column in another excel sheet within the same workbook and add certain information. Can this be done?

  2. #2

    Join Date
    Feb 2002
    Posts
    39
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try recording a macro.

  3. #3
    New Member
    Join Date
    May 2002
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I'm new at recording macro's and writing any sort of VBA code. Everytime I try to do anything with a macro it says the macros in this project are disabled and to find help on how to enable the macros. It wasn't helpful at all on how to enable macros. any information you can provide would be great. Thanks.

  4. #4
    Board Regular Corticus's Avatar
    Join Date
    Apr 2002
    Location
    Sarasota, FL
    Posts
    1,579
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Insert a button, then put this code in the button:

    Columns("A:A").Select
    Selection.Insert Shift:=xlToRight
    Range("A1").Select

    Of course, replace A:A with where you want the row to be inserted. Do you need to tell it every time a different place to insert the row?

    HTH
    -Corticus



  5. #5
    Board Regular Corticus's Avatar
    Join Date
    Apr 2002
    Location
    Sarasota, FL
    Posts
    1,579
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    make sure you don't tell Excel to disable macros when you open the sheet!

  6. #6
    New Member
    Join Date
    May 2002
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks for the info
    yes, I guess the columns would have to be inserted after the last column with information. how would i incorporate that into the macro. also how do i not tell it to disable macros everytime i open the sheet up if macros was never enabled?

  7. #7
    Board Regular Corticus's Avatar
    Join Date
    Apr 2002
    Location
    Sarasota, FL
    Posts
    1,579
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    go to Tools-Macro-Security and lower your security setting, as far as inserting to column at the end, I would like to know myself!

    Corticus

  8. #8
    New Member
    Join Date
    May 2002
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I tried the macro security setting and the same message pops up
    "The macros in this project are disabled. Please refer to the online help or documentation of the host application to determine how to enable macros." and the title of that little pop up msgbox is from Visual Basic.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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