+ Reply to Thread
Results 1 to 2 of 2

Macro to cut-and-paste Autotext

Hybrid View

  1. #1
    Registered User
    Join Date
    02-25-2005
    Posts
    1

    Macro to cut-and-paste Autotext

    Hi,

    I'm creating a timeline which has special formatting for each new activity. I want to create a macro that will insert a new activity at the cursor every time I run it. So far, I have:

    Sub Activity()
    '
    ' Activity Macro
    ' This macro adds a new activity.
    '
    ' Keyboard Shortcut: Ctrl+Shift+A
    '
    ActiveWindow.SmallScroll Down:=-36
    Rows("9:10").Select
    Selection.Copy
    ActiveWindow.SmallScroll Down:=30
    Rows("42:42").Select
    ActiveSheet.Paste
    Rows("42:42").Select
    Application.CutCopyMode = False
    End Sub


    But, what this does is paste the text from Rows 9 and 10 always into Rows 42. How can I write the macro so it will paste the text into whatever row is active?

    Thanks!

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Whyloo,

    Add this code into your routine where appropriate. This will select the row of the active cell on the active worksheet.

    R = ActiveCell.Row
    ActiveSheet.Rows(R).Select


    Hope this helps,
    Leith Ross

+ 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