#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Discussion (Misc queries) 1 May 3rd 08 10:52 AM
Macro error MikeD1224 Excel Discussion (Misc queries) 1 March 9th 07 12:28 AM
Macro error : Application-defined or object-defined error Joe Excel Discussion (Misc queries) 3 January 27th 06 02:32 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM


All times are GMT +1. The time now is 05:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"