View Single Post
 
Old 10-23-2021, 06:28 PM
minerva.goree minerva.goree is offline Windows 10 Office 2019
Novice
 
Join Date: Oct 2021
Posts: 6
minerva.goree is on a distinguished road
Default

Hi Miles,

I did a quick test and this worked for me. I do have a newer version of Office, so I don't know if it will work for you.

You can change the range to wherever you need it. I didn't specify the size of my table, just a simple paste to start at the cell I chose for my range:

Code:
Sub test()

    'Select all data and copy
    Application.SelectAll
    Application.EditCopy


    ' Excel - setup
    Set xlApp = GetObject(, "Excel.application")
    
    If xlApp Is Nothing Then
        Set xlApp = CreateObject("Excel.Application")
    End If
    
    ' Excel - create a new workbook
    xlApp.Visible = True
    xlApp.Workbooks.Add
    
    ' Excel - create column headings
    Set xlRange = xlApp.Range("A1")
    
    xlRange.PasteSpecial Paste:=xlPasteValues

End Sub
Minerva
Home | Mad Schedules With Minerva Goree
YouTube: mad schedules - YouTube
Reply With Quote