View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
LarryP LarryP is offline
external usenet poster
 
Posts: 73
Default UsedRange and Ctrl-Shift-End Mystery

PUZZLE OF THE DAY: I have an Excel file with a worksheet where columns A:D
(only) are populated with a variable amount of data -- could be three rows,
could be a thousand. For this discussion, let's say there are 50 rows.

When I select A1 and then hit Ctrl-Shift-End, I would expect A1:D50 to be
selected, but I get A1:IV50. I've tried selecting columns E:IV and deleting
them entirely to supposedly reset the used range, but get the same result
when I hit Ctrl-Shift-End.

To make it even more puzzling, if I copy the data from A1:D50 into a new
worksheet in the same workbook, Ctrl-Shift-End works as expected.

And finally, I wrote a little code snippet to show me
ActiveWorkbook.Sheets("nameofsheet").UsedRange.Col umns.Count, and it returns
4 in BOTH worksheets.

Who can suggest why this is happening (and ideally, a way to fix it
programmatically)? It's screwing me up when I try to import the weird
worksheet into MSAccess.