LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default For Each sheet in WkBook problem


Can't say for sure without looking at your file. If there's any reason
vData is not a 2D array then that line will definitely throw an error.
Try this on any sheet...


Sub test()
Dim v
v = Range("A1:D2")
Debug.Print "rows:=" & UBound(v)
Debug.Print "cols:=" & UBound(v, 2)
End Sub

..and it should return...

rows:=2
cols:=4


Garry


It returned 2 & 4 for every sheet, Summary & A to G, and the same for a new workbook made with same names and the data copied to each sheet.

I did notice while the .cells... line was yellow highlighted that the .End(xlDown) was showing -4162 when mouse over it.



vData = wks.Range("A2", wks.Range("D2").End(xlDown))

'Assign the array to the next row position
.Cells(lNextRow, 1).Resize(UBound(vData), UBound(vData), 2) = vData

Then another time it showed a date. Column D header is "Datum" and custom formatted to dd-mm-yyy.

I have no idea why it showed -4162 that one time.

Howard
 
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
Update Cell in WKBook 1 From WkBook 2 pattlee Excel Discussion (Misc queries) 2 May 25th 08 01:27 PM
VBA Open Wkbook Disabling Macros Karen53 Excel Programming 9 March 21st 08 08:54 PM
How to link to a single wksheet in a wkbook that has comments RedRobyn Excel Discussion (Misc queries) 1 June 27th 06 07:40 PM
[hlp]: How to copy a sheet to new wkbook and close the var at the end pao_e_vinho[_2_] Excel Programming 2 June 27th 06 06:21 PM
Can changes to a worksheet be applied to all wksheets in wkbook? SandyM Excel Worksheet Functions 1 September 18th 05 06:21 PM


All times are GMT +1. The time now is 06:22 PM.

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"