|
-
Oct 28th, 2013, 09:28 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] How does Excel set the used range?
Is there a dependable way to cause Excel to set the used range (i.e., last row, last column) of a worksheet other than saving the workbook? I have an application where I filter a sheet and then delete all visible rows. When I copy that sheet to another sheet, the used ranges of each sheet do not agree. By accident, if I msgbox the function xllastrow of each sheet, then they agree. But I don't want to msgbox and I don't want to save teh workbook. Thanks.
-
Oct 29th, 2013, 07:22 AM
#2
Re: How does Excel set the used range?
What are you doing with the "used range" that requires them to agree?
-
Oct 29th, 2013, 09:58 AM
#3
Thread Starter
Hyperactive Member
Re: How does Excel set the used range?
I am filtering Sheet1 and removing all rows that I do not need. Then I am copying Sheet1 using 'Move or Copy'. Then I want to replace all formulas on Sheet1 (2) by using 'ActiveSheet.UsedRange.Value = Sheets("Imported Data").UsedRange.Value'. Sheet1 (2) ends up with #NA rows at the end of sheet. The number of #NA rows is exactly the number of rows that I deleted on Sheet1. I've tried to active sheet calculate but that ddoesn't work. When I msgbox xlLastRow("Sheet1"), it displays the correct row number, but it is copying beyond that row. If I msgbox the Sheet1.usedrange before I copy, then the correct number of rows is copied.
-
Oct 29th, 2013, 10:04 AM
#4
Thread Starter
Hyperactive Member
Re: How does Excel set the used range?
I got around the problem by calculating the Sheet1.usedrange before copying. Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|