Solved

Excel .end(xlUp) fails

Posted on 2012-12-28
7
1,009 Views
Last Modified: 2012-12-29
The sub writes messages in Outlook to an Excel file. I need the script to select to lastRow in the excel file but the line "rInt = xlWks.Range("A65536").End(xlUp).Row" errors.
ol-xl-error.txt
0
Comment
Question by:spitcha
7 Comments
 
LVL 39

Expert Comment

by:nutsch
ID: 38728681
dim rInt as a long instead, you probably have more than the 32 some thousands supported by the integer data type.
0
 

Author Comment

by:spitcha
ID: 38728690
Thanks for the reply. I get the same error after changing rInt to long
0
 
LVL 22

Expert Comment

by:Flyster
ID: 38728728
See if this will work:

rInt = .Cells(.Rows.Count, "A").End(xlUp).Row

Flyster
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

Author Comment

by:spitcha
ID: 38728740
Nope. Still getting the same error.
0
 

Author Comment

by:spitcha
ID: 38728756
The issue is with end(xlUp). I'm able to select or get any value, leaving this query out.
0
 
LVL 33

Accepted Solution

by:
Norie earned 500 total points
ID: 38728759
xlUp is an Excel constant, you either need to use it's value,  -4162, or add a declaration for it.
Const xlUp = -4162

Open in new window

0
 

Author Closing Comment

by:spitcha
ID: 38728764
Adding this line fixed the issue.
Thanks much!
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question