Solved

Excel .end(xlUp) fails

Posted on 2012-12-28
7
1,023 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
How to resolve IMCEAEX NDRs in Exchange or Exchange Online related to invalid X500 addresses.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

762 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