View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default For Each sheet in WkBook problem

On Thursday, November 26, 2015 at 6:28:10 PM UTC-8, GS wrote:
Only changed it because that line erroed out, I tried 4 and it
works with the 4.


Something wrong there! I ran the code with dummy data and it works
just fine...

--
Garry


What would I look for on the sheet/s or workbook?

Howard


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

...in the IW. Note that the range doesn't need to contain any data.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion