View Single Post
 
Old 03-24-2015, 11:04 PM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The Excel format is not the problem What are important are these three values, which must match the Excel file being processed.

Const strCell As String = "E2"
Const strWorkBook As String = "Count0To12Hr.xls"
Const strSheet As String = "Count0To12Hr"

Also change
Code:
lngCell = xlSheet.Range(strCell)
to
Code:
lngCell = Val(xlSheet.Range(strCell))
which should resolve the issue with negative values.

While testing make the Excel app visible so that if it does crash you are not left with a hidden Excel application.

Code:
xlApp.Visible = True
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote