Macro to Cut-And-Paste Text

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!
 
Try this...

Sub Activity()
'
' Activity Macro
' This macro adds a new activity.
'
' Keyboard Shortcut: Ctrl+Shift+A
'
Rows("9:10").Copy ActiveCell.EntireRow

Application.CutCopyMode = False
End Sub

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top