Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Excel .end(xlUp) fails

Posted on 2012-12-28
7
Medium Priority
?
1,136 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
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 

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 35

Accepted Solution

by:
Norie earned 2000 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Suggested Courses

971 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