Macro Error
I have the following Macro (BELOW) in a workbook. It
works in opening the daily updated workbook "degreedays.xls" but what I want is this workbook to open in another workbook when the user runs the macro on the worksheet "Weather" in the ddays.xls workbook. Thanks in advance for looking at my problem. Krefty Option Explicit Sub Macro1() Dim destCell As Range Dim degreedays As Workbook With Workbooks("ddays.xls").Worksheets("Weather") .UsedRange.Clear Set destCell = .Cells(.Rows.Count, "A").End (xlUp).Offset(1, 0) End With Workbooks.OpenText Filename:="G:\Gas_Control\EXCEL\DEPT\Month Reports\degreedays.xls", _ Origin:=xlWindows, _ StartRow:=1, DataType:=xlFixedWidth, _ FieldInfo:=Array(Array(0, 1), Array(8, 1), _ Array(30, 1), Array(41, 1), Array(67, 1), Array (78, 1)) End Sub |
Macro Error
Sub Macro1()
Dim destCell As Range Dim degreedays As Workbook With Workbooks("ddays.xls").Worksheets("Weather") .UsedRange.Clear Set destCell = .Cells(.Rows.Count, "A").End (xlUp).Offset(1, 0) End With Workbooks.OpenText Filename:="G:\Gas_Control\EXCEL\DEPT\Month Reports\degreedays.xls", _ Origin:=xlWindows, _ StartRow:=1, DataType:=xlFixedWidth, _ FieldInfo:=Array(Array(0, 1), Array(8, 1), _ Array(30, 1), Array(41, 1), Array(67, 1), Array (78, 1)) ActiveSheet.Range("A1").CurrentRegion.Copy _ Destination:=destCell ActiveWorkbook.Close Savechanges:=False End Sub Regards, Tom Ogilvy "Krefty" wrote in message ... I have the following Macro (BELOW) in a workbook. It works in opening the daily updated workbook "degreedays.xls" but what I want is this workbook to open in another workbook when the user runs the macro on the worksheet "Weather" in the ddays.xls workbook. Thanks in advance for looking at my problem. Krefty Option Explicit Sub Macro1() Dim destCell As Range Dim degreedays As Workbook With Workbooks("ddays.xls").Worksheets("Weather") .UsedRange.Clear Set destCell = .Cells(.Rows.Count, "A").End (xlUp).Offset(1, 0) End With Workbooks.OpenText Filename:="G:\Gas_Control\EXCEL\DEPT\Month Reports\degreedays.xls", _ Origin:=xlWindows, _ StartRow:=1, DataType:=xlFixedWidth, _ FieldInfo:=Array(Array(0, 1), Array(8, 1), _ Array(30, 1), Array(41, 1), Array(67, 1), Array (78, 1)) End Sub |
All times are GMT +1. The time now is 11:35 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com