Given this code: totalRows = Worksheets("sheet1").UsedRange.Rows.Count For Each r In Worksheets("Sheet1").Range(Cells(3, 4), Cells(totalRows, 4))
VBA gives a 1004 error immediately (does not enter the loop) on the For Each line - this confuses me because: 1. There is a "Sheet1" worksheet 2. The variable totalRows resolves to an accurate number 3. Cells(3,4) resolves to the indended cell value 4. The same code works on other worksheets of similar dimensions Any initial thoughts? Thanks in advance, Al --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---