[Excel / VBA]:如何解决Timeserial函数中的溢出错误(ErrorId:6)? [英] [Excel/VBA]: How to resolve Overflow Error (ErrorId: 6) in Timeserial Function?

查看:200
本文介绍了[Excel / VBA]:如何解决Timeserial函数中的溢出错误(ErrorId:6)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我导入了一个巨大的文件(35 MB日志文件)。该文件包含一个名为Seconds的列。其中包含从1开始的每秒数据。


初始时间和日期也在报告中给出。


现在我正在尝试要做的是在此工作表中插入名为开始时间的另一列。然后对于对应于秒的每个值。列,我将它添加到报告中给出的初始时间。然后将该值与日期一起显示为开始时间。柱。子程序是:

Hi,

I have imported a huge file(35 MB log file). This file contains a column called "Seconds" which contain data for each seconds starting from 1.

Initial Time and date is also given in the report.

Now what i am trying to do is to insert another column in this sheet called "Start Time". Then for each value corresponding to "Seconds" column, i am adding it to Initial Time given in the report. This value along with date is then displayed "Start Time" column. The subroutine for this is:


展开 | 选择 | Wrap | 行号

推荐答案

尝试声明TotalSeconds作为Long而不是Variant。
Try declaring TotalSeconds As Long instead of Variant.


我也试过了。但是没有工作。

TimeSerial函数的参数如下:

TimeSerial(小时为整数,分钟为整数,秒为整数)


如你所见,秒和秒。数据类型是Integer。我想是因为这个,我在TimeSeconds = 32687溢出了


为此做任何工作
I have tried it that as well. But didn''t work.
Argument of TimeSerial function is as follow:
TimeSerial(Hour As Integer, Minute As Integer, Seconds As Integer )

As you can see, "Seconds" data type is Integer. I guess because of this, i am getting overflow at TimeSeconds = 32687

Anywork around for this


OK我遇到了一些问题跟着你在做什么。


所以secValue是一个非常大的数字,表示已经消失的秒数?

从中你减去秒数开始时间。这是如何导致少于60的数字,这是TimeSerial函数中TotalSeconds值所需的数量?
OK I''m having a few problems following what you are doing.

So secValue is a very large number representing the number of seconds elaspsed?
From that you subtract the number of seconds from the start time. How does this result in a number less that 60 which is what you would need for the TotalSeconds value in the TimeSerial function?


这篇关于[Excel / VBA]:如何解决Timeserial函数中的溢出错误(ErrorId:6)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆