ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automated data logging with excel (https://www.excelbanter.com/excel-programming/398482-automated-data-logging-excel.html)

Andrew[_56_]

Automated data logging with excel
 
Hello,
I am working on a visual basic project which reads values from an
external source and puts those values into an excel worksheet, into
pre-defined cells. These values change once every minute. What I
would like to do is to write a visual basic program which will take
data from sheet 1 and then store it into sheet two. This will happen
once a minute. And so for the first reading, the program will take
the values from sheet one and write them into row 1 of sheet 2. And
for the second reading, it will take the values from sheet one and
write them into row 2 of sheet 2, and so on.
Also, this program will be taking in a lot of data, and so I would
like the sheet to autosave every hour.
Can someone help me out with either of these functions? I have a
lot of programming experience, though not in visual basic. Please
include details.

thanks,
Andy


FSt1

Automated data logging with excel
 
hi
as to the data transfer, try something like this....
Private Sub TransferData()
Dim r1 As Range
Dim r2 As Range
Sheet1.Activate
Set r1 = Cells(65536, 1).End(xlUp)
Set r2 = Sheet2.Cells(65536, 1).End(xlUp).Offset(1, 0)
r2.Value = r1.Value
r2.Offset(0, 1).Value = r1.Offset(0, 1).Value
r2.Offset(0, 2).Value = r1.Offset(0, 2).Value
r2.Offset(0, 3).Value = r1.Offset(0, 3).Value
'add more if needed
End Sub
as to the time of transfer, look up the on time method in vb help or see
this site...
http://www.cpearson.com/excel/ontime.htm
and to the auto save every hour, i'm having trouble with that myself
see this site...
http://www.mvps.org/dmcritchie/excel/datetime.htm

regards
FSt1

"Andrew" wrote:

Hello,
I am working on a visual basic project which reads values from an
external source and puts those values into an excel worksheet, into
pre-defined cells. These values change once every minute. What I
would like to do is to write a visual basic program which will take
data from sheet 1 and then store it into sheet two. This will happen
once a minute. And so for the first reading, the program will take
the values from sheet one and write them into row 1 of sheet 2. And
for the second reading, it will take the values from sheet one and
write them into row 2 of sheet 2, and so on.
Also, this program will be taking in a lot of data, and so I would
like the sheet to autosave every hour.
Can someone help me out with either of these functions? I have a
lot of programming experience, though not in visual basic. Please
include details.

thanks,
Andy




All times are GMT +1. The time now is 05:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com