Solved

Excel .end(xlUp) fails

Posted on 2012-12-28
7
982 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
If you don't know how to downgrade, my instructions below should be helpful.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now