Home
FREE DOWNLOADS
VBA Tutorials
VBA CodeSamples
VBA for Beginners
Save Time News
Outlook Tutorials
Save Time Blog
SaveTime SiteMap
Excel VBA Code
PageNotActive
Other Tutorials
About This Website

Subscribe To This Site
XML RSS
Add to Google
Add to My Yahoo!
Add to My MSN
Subscribe with Bloglines


Copy Paste VBA

To do Copy Paste VBA is basically the same whether in Word or Excel. First you select what you what to be copied, either manually or also through VBA, and the you select the cell in Excel or an insertion point in Word, Again, by selecting this manually or with VBA itself.

If you need help with writing macros/VBA code, run through our free tutorials.

in Excel...

Sub VBA_Copy()
    ' Delete the next line if you already have a value in cell A1
    ActiveCell.FormulaR1C1 = "Cell A1 text"
    Range("A1").Select
    Selection.Copy
End Sub

Sub VBA_Paste()
    ' Delete the next line if you are manually selecting where to paste.
    Range("D7").Select
    ActiveSheet.Paste
End Sub 


To Copy Paste VBA in Word...

Sub VBA_Copy()
    ' Delete the next 3 lines if you are manually selecting the text to copy
    Selection.TypeText Text:="Sample text"
    Selection.HomeKey Unit:=wdLine
    Selection.EndKey Unit:=wdLine, Extend:=wdExtend
    ' Delete until here if you are manually selecting the text to copy
    Selection.Copy
End Sub

Sub VBA_Paste()
    ' Delete the next 3 lines if you are manually selecting where to paste
    Selection.EndKey Unit:=wdLine, Extend:=wdExtend
    Selection.TypeParagraph
    Selection.TypeParagraph
    ' Delete until here if you are manually selecting where to paste
    Selection.PasteAndFormat (wdPasteDefault)
End Sub




Google


Return from Copy Paste VBA to VBA Code Samples


Return to our Homepage


footer for Save Time page