Closed Thread
Results 1 to 4 of 4

Insert Code

  1. #1
    Derek Y via OfficeKB.com
    Guest

    Insert Code

    I have some VBA code that I would like to insert into an excel worksheet

    With ActiveCell.Columns
    .EntireColumn.Copy
    .EntireColumn.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
    SkipBlanks _
    :=False, Transpose:=False

    End With
    Application.CutCopyMode = False

    I thought all I would have to do is create a macro, use the macro editor and
    paste in this code instead and run that macro, and this code would run
    instead.....Thats not working.......how do i run this code??


    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...l-new/200510/1

  2. #2
    Max
    Guest

    Re: Insert Code

    Try this ..

    Press Alt+F11 to go to VBE
    Click Insert > Module
    Paste the sub* below in the code window
    *containing your code

    Press Alt+Q to get back to Excel

    Test it out on a column with some formulas in your test sheet:
    Select any cell in the col, press Alt+F8,
    select "FreezeColumn" > Run
    (The code will perform an "in-place"
    copy > paste special > values on the col,
    effectively killing all formulas in the col)

    Sub FreezeColumn()
    With ActiveCell.Columns
    .EntireColumn.Copy
    .EntireColumn.PasteSpecial Paste:=xlPasteValues, _
    Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    End With
    Application.CutCopyMode = False
    End Sub
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Derek Y via OfficeKB.com" <u13919@uwe> wrote in message
    news:55f2dcfb20573@uwe...
    > I have some VBA code that I would like to insert into an excel worksheet
    >
    > With ActiveCell.Columns
    > .EntireColumn.Copy
    > .EntireColumn.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
    > SkipBlanks _
    > :=False, Transpose:=False
    >
    > End With
    > Application.CutCopyMode = False
    >
    > I thought all I would have to do is create a macro, use the macro editor

    and
    > paste in this code instead and run that macro, and this code would run
    > instead.....Thats not working.......how do i run this code??
    >
    >
    > --
    > Message posted via OfficeKB.com
    > http://www.officekb.com/Uwe/Forums.a...l-new/200510/1




  3. #3
    Derek Y via OfficeKB.com
    Guest

    Re: Insert Code

    THANK YOU SOOO MUCH, i didn't have SUB and END SUB that was my problem........
    thanks sooo very much!

    Max wrote:
    >Try this ..
    >
    >Press Alt+F11 to go to VBE
    >Click Insert > Module
    >Paste the sub* below in the code window
    >*containing your code
    >
    >Press Alt+Q to get back to Excel
    >
    >Test it out on a column with some formulas in your test sheet:
    >Select any cell in the col, press Alt+F8,
    >select "FreezeColumn" > Run
    >(The code will perform an "in-place"
    >copy > paste special > values on the col,
    >effectively killing all formulas in the col)
    >
    >Sub FreezeColumn()
    > With ActiveCell.Columns
    > .EntireColumn.Copy
    > .EntireColumn.PasteSpecial Paste:=xlPasteValues, _
    > Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    > End With
    > Application.CutCopyMode = False
    >End Sub
    >--
    >Rgds
    >Max
    >xl 97
    >---
    >Singapore, GMT+8
    >xdemechanik
    >http://savefile.com/projects/236895
    >--
    >> I have some VBA code that I would like to insert into an excel worksheet
    >>

    >[quoted text clipped - 10 lines]
    >> paste in this code instead and run that macro, and this code would run
    >> instead.....Thats not working.......how do i run this code??



    --
    Message posted via http://www.officekb.com

  4. #4
    Max
    Guest

    Re: Insert Code

    Glad you found out what was missing <g> !
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Derek Y via OfficeKB.com" <u13919@uwe> wrote in message
    news:55f3ad2e0b6f3@uwe...
    > THANK YOU SOOO MUCH, i didn't have SUB and END SUB that was my

    problem........
    > thanks sooo very much!




Closed 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