Creating a sheet at set times

S

Scott

Hi,
I was hoping someone could help with this,I have very
little experience with excel but not unfamiliar with
programming (mostly PLC programming).So here's my dilemma:
I am importing data from a dde server (directsoft32 data
server) into cells which works fine,I can create a macro
to move the data to another sheet,but I need to move to 3
different sheets depending on the time. (8:00,4:00,12:00),
and reset the counters in the plc.
I aquire the data with:
c3=dsdata|weightcell1!'v2001'
c4=dsdata|weightcell2!'v2004'
c5=dsdata|weightcell3!'v2007'
c6=dsdata|weightcell4!'v2010'
c6=dsdata|Cam1!'v1001' (Pass Counter)
c8=dsdata|Cam1!'v1002' (Fail Counter)
c9=dsdata|Cam2!'v1003' (Pass Counter)
c10=dsdata|Cam2!'v1004' (Fail Counter)
c11=dsdata|Cam3!'v1005' (Pass Counter)
c12=dsdata|Cam3!'v1006' (Fail Counter)
c13=dsdata|Cam1!'v1007' (Pass Counter)
c14=dsdata|Cam1!'v1008' (Fail Counter)

The "V"s are memory locations in the plc that I'm
referencing.

And to reset I use a macro:
Sub Button1_Click()
Channel = DDEInitiate ("Dsdata","weightcells")
DDEPoke Channel,"V2001", 0
DDEPoke Channel,"V2002", 0
DDEPoke Channel,"V2003", 0
DDEPoke Channel,"V2004", 0
DDETerminate (Channel)
Channel = DDEInitiate ("Dsdata","Cameras")
DDEPoke Channel,"V1001", 0
DDEPoke Channel,"V1002", 0
DDEPoke Channel,"V1003", 0
DDEPoke Channel,"V1004", 0
DDEPoke Channel,"V1005", 0
DDEPoke Channel,"V1006", 0
DDEPoke Channel,"V1007", 0
DDEPoke Channel,"V1008", 0
DDETerminate (Channel)
End Sub

Any help would be greatly appreciated
Thanks in advance
Blue Skies
Scott
 
C

Colo

Hello Scott,

You can specify the worksheets with worksheet object.
It can be done with the name of the worksheet or index,
Eg, Sheets(1) stands for Very left worksheet in the active workbook.
If the name of the Sheets(1) is Sheet1, then you can also specify the
worksheet as Sheets("Sheet1").

With NOW function, VBA returns the system time(including date), I think you
can use it for judging time.

--
Kind Regards
Colo ------------------------------------------------------------------
Masaru Kaji (aka Colo) Office Systems - Excel MSMVP(2004-2005)

Web site: Colo's Excel Junk Room
http://www.interq.or.jp/sun/puremis/colo/

Email: (e-mail address removed)
 
Top