LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Error when selecting date range.

I have a little piece of code that worked in one workbook, however;
when I copied it over to another workbook I get the following error:
Run-Time error '1004':
Method 'Range' of object '_Global' failed

The code used copies to a column based on the date with the date range
starting in B3 and going until AF3. It selected the range correctly,
but just fails. What I don't understand is why the exact same code
will work in one workbook and not in another.

Of note the Macro's are held in a seperate workbook that opens a total
of 3 other workbooks.
The workbook and worksheet that uses the code are the active workbook/
worksheet.

Here is the code used:

Sub COPY_PASTE()
'
Range("AI7:AI299").Select
Selection.Copy
Application.Run ("DateColumn")
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

Sub DateColumn()
Windows("WORKBOOK.XLS").Activate
Sheets("WORK SHEET").Select
Range("B3").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Find(What:=Range("DATE"), After:=ActiveCell,
LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(4, 0).Select

End Sub

Any help will be greatly appreciated.

Thanks,
Christopher
 
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
Selecting data within a date range mtaylor Excel Worksheet Functions 1 September 1st 05 12:17 PM
Runtime Error 1004 on selecting range MaltzMD Excel Programming 5 July 23rd 05 03:33 AM
Help! Selecting data according to date range redbna Excel Discussion (Misc queries) 0 June 8th 05 06:58 PM
1004 error when selecting a range Matt J[_2_] Excel Programming 9 July 3rd 04 10:05 PM
Error 1004 when selecting a range Matt J Excel Programming 1 July 3rd 04 06:50 PM


All times are GMT +1. The time now is 07:34 PM.

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"