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: 1
Default sub script out of range problem


Dear all, I posted a question some days ago, and received an answer
however when I run the suggested code it gives me a "sub script out o
range" error message.
I include the code for you:

Option Explicit

Sub DataToReport()
Dim wb As Workbook
Dim rng As Range
Dim lr As Long

Windows("file1").Activate
With Worksheets("data")
lr = .Cells(Rows.Count, "E").End(xlUp).down
Set rng = .Range("C6:E" & lr)
Set rng = Union(rng, .Range("K6:K" & lr))
Set rng = Union(rng, .Range("M6:M" & lr))
End With

Set wb = Workbooks("file2.xls")
rng.Copy wb.Worksheets("data2").Range("B484")

End Sub

The idea is to take columns C,D,E,K,L,M from file1 sheet "data" an
copy into file2 sheet "data2". The data in file1 will vary in length
but always starts in row6.
When it is copied across, it always starts on row 484.
The columns are all of equal length, I just cant work out what i
wrong.

Please help if you can.
love
Amy xx :

--
AmyTaylo
-----------------------------------------------------------------------
AmyTaylor's Profile: http://www.excelforum.com/member.php...fo&userid=2097
View this thread: http://www.excelforum.com/showthread.php?threadid=39010

 
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
Script out of range error [email protected] Excel Programming 5 May 24th 05 09:37 PM
Problem with printing from VB-script in Excel Jo Segers Excel Programming 2 January 28th 05 07:25 AM
Row deleting script problem jessica Excel Programming 1 October 15th 03 11:55 AM
Run Time Error 9, Script Out of Range Jeff Marshall[_2_] Excel Programming 1 October 2nd 03 01:50 AM
Graph problem with VBA script Jon Peltier[_3_] Excel Programming 0 August 7th 03 02:05 AM


All times are GMT +1. The time now is 06:17 AM.

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

About Us

"It's about Microsoft Excel"