View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default Copy to different workbook without opening it

I've got the following code that records usage data for userform results.
'Mileage' is the name of the userform. I am merely copying the selection of
a combobox to another workbook. I would like to do this without opening the
other workbook.

Thanks

Sub Mileage_ReportTop5Data()
Dim ClosestTo As Variant
Dim ReportLoc As String

ClosestTo = Mileage.ComboClosestTo.Value
ReportLoc = "\\Trimain2\Public\Agent Forms\Forms\Data Sheets\Mileage
Requests.xls"

Application.ScreenUpdating = False
Workbooks.Open FileName:=ReportLoc
Sheets("Resorts Used").Range("B65536").End(xlUp).Offset(1, 0).Value =
ClosestTo
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub