Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default range.offset generates a Run Time error 1004

Hi,

In the code below I'm getting a 'Run Time error 1004: application
defined or object-defined error when I try offset a range by a value
greater than 32231. Can anybody explain why this happening. I'm
trying to append some data to the end of a dynamic range, can I use
something else instead of range.offset?

Sub AddNewLogs(MyLogArr())

Dim rngRefLogs As Range
Dim rngRefLogsDateCol As Range
Dim rngTemp As Range
Dim LastRow As Long
Dim LastCol As Integer



'activate the logs worksheet
Sheets("Logs").Activate
'set the dynmaic range
Set rngRefLogs = Range("RefLogs")
'get the lastrow in Column A
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
'Set temporary range offset from the end of our dynamic range by the
number of rows it contains
Set rngTemp = rngRefLogs.Offset(LastRow - 1, 0)
'extend the temporary range by the number records in our array
Set rngTemp = rngTemp.Resize(UBound(MyLogArr, 1) - LBound(MyLogArr, 1)
+ 1, 6)
'set the temporary range to the value of the array
rngTemp.Value = MyLogArr
'refresh the pivot table
ActiveWorkbook.RefreshAll
'save the work book
ActiveWorkbook.Save
'switch focus to the analysis sheet
Sheets("Analysis").Activate

End Sub



Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default range.offset generates a Run Time error 1004

Unless you are using Excel 2007, there are only 65536 rows in a worksheet.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



wrote in message
Hi,
In the code below I'm getting a 'Run Time error 1004: application
defined or object-defined error when I try offset a range by a value
greater than 32231. Can anybody explain why this happening. I'm
trying to append some data to the end of a dynamic range, can I use
something else instead of range.offset?

Sub AddNewLogs(MyLogArr())
Dim rngRefLogs As Range
Dim rngRefLogsDateCol As Range
Dim rngTemp As Range
Dim LastRow As Long
Dim LastCol As Integer

'activate the logs worksheet
Sheets("Logs").Activate
'set the dynmaic range
Set rngRefLogs = Range("RefLogs")
'get the lastrow in Column A
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
'Set temporary range offset from the end of our dynamic range by the
number of rows it contains
Set rngTemp = rngRefLogs.Offset(LastRow - 1, 0)
'extend the temporary range by the number records in our array
Set rngTemp = rngTemp.Resize(UBound(MyLogArr, 1) - LBound(MyLogArr, 1)
+ 1, 6)
'set the temporary range to the value of the array
rngTemp.Value = MyLogArr
'refresh the pivot table
ActiveWorkbook.RefreshAll
'save the work book
ActiveWorkbook.Save
'switch focus to the analysis sheet
Sheets("Analysis").Activate
End Sub
Thanks

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
Help! Run time error 1004, range of object_global failed in-over-his-head-bill Excel Programming 9 July 12th 06 05:46 AM
Button programming Run-time error '1004' with range El_Pablo[_3_] Excel Programming 2 April 4th 06 04:46 PM
Run-time error '1004' on Range.Activate Don Rouse Excel Programming 9 August 25th 05 04:05 PM
Run-time error '1004' PasteSpecial Method of Range Class Failed Kevin G[_2_] Excel Programming 1 February 3rd 04 05:01 AM
Run-time 1004 error on range select Morgan[_3_] Excel Programming 3 November 11th 03 11:44 PM


All times are GMT +1. The time now is 05:03 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"