UsedRange?? problem

G

Geoff

Hi
Using this on wbooks (from another source):
realLastRow = .Cells.Find("*", .Range("A1"), , , xlByRows, xlPrevious).Row
realLastColumn = .Cells.Find("*", .Range("A1"), , , xlByColumns,
xlPrevious).Column

Gives realLastRow = 98 and realLastColumn = S
Debug.Print Sheets(1).UsedRange.Address = $D$7:$D$13
But Ctrl + Shift + End goes to AF50918. This has a serious effect on VBA
processing time. 'Processing' involves copy ,paste, find, delete, replace
functionality.

What does AF50918 represent?
What is the fastest possible way of removing this large unwanted area before
processing the real data?

T.I.A

Geoff
 
G

Geoff

Correction:
Changed Sheet1 to Activesheet in debug and got:
Debug.Print ActiveSheet.UsedRange.Address = $A$1:$AF$50918

I did wonder how usedrange could be less than reallastrow, reallastcolumn.
So the issue is all about UsedRange and how to quickly realign it to
reallastrow etc.

Geoff
 
J

Jim Rech

Delete (not Clear) all rows and columns after the last real cell and save
the workbook.

--
Jim
| Correction:
| Changed Sheet1 to Activesheet in debug and got:
| Debug.Print ActiveSheet.UsedRange.Address = $A$1:$AF$50918
|
| I did wonder how usedrange could be less than reallastrow, reallastcolumn.
| So the issue is all about UsedRange and how to quickly realign it to
| reallastrow etc.
|
| Geoff
|
| "Geoff" wrote:
|
| > Hi
| > Using this on wbooks (from another source):
| > realLastRow = .Cells.Find("*", .Range("A1"), , , xlByRows,
xlPrevious).Row
| > realLastColumn = .Cells.Find("*", .Range("A1"), , , xlByColumns,
| > xlPrevious).Column
| >
| > Gives realLastRow = 98 and realLastColumn = S
| > Debug.Print Sheets(1).UsedRange.Address = $D$7:$D$13
| > But Ctrl + Shift + End goes to AF50918. This has a serious effect on
VBA
| > processing time. 'Processing' involves copy ,paste, find, delete,
replace
| > functionality.
| >
| > What does AF50918 represent?
| > What is the fastest possible way of removing this large unwanted area
before
| > processing the real data?
| >
| > T.I.A
| >
| > Geoff
| >
 
G

Geoff

Hi Dave
Thanks, I have used that succesfully in the past though it is slow.
With the wbook in question it takes nearly 3 seconds to clear up the range.
Might not sound a lot but when dealing with multi wbooks it piles up. And in
the overall context I have put a great deal of effort into shaving time off
processing and it niggles when something takes twice as long as it need.

Geoff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top