Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Cut-And-Paste Text
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Cut-And-Paste Text
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 "whyloo" wrote: 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! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to find text string in a column and paste data in another | Excel Discussion (Misc queries) | |||
Copy and Paste macro needs to paste to a changing cell reference | Excel Programming | |||
Macro to Paste to specific line, and continue to Paste each time on next row not over | Excel Programming | |||
Macro-Text from word doc paste to excel empty row | Excel Programming |