Scheduling Data Collection

cram8603

New Member
Joined
Nov 3, 2008
Messages
3
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
I am using a macro to collect data on manufacturing processes every 5 minutes, Our Company has 3 shifts. On week days I can start the macro when I leave to collect data through 2<SUP>nd</SUP> and 3<SUP>rd</SUP> shift. I need data from certain shifts on the weekend, If I leave the macro running, starting Friday, I run out of columns. Is there any way to specify a start date and time for my macro, or maybe move to new sheets once the current one is filled?
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi
It is possible to set a time frame or specify the location to collect data. Can you share your current codes so that it can be modified suitably?
Ravi
 
Upvote 0
Sub Data14()
Dim TargetSht As Worksheet, SourceSht As Worksheet, SourceCol As Integer, SourceCells As Range
Set SourceSht = ThisWorkbook.Sheets("TP14")
Set TargetSht = ThisWorkbook.Sheets("Data")
Set SourceCells = SourceSht.Range("N2:N19" & SourceSht.Range("B65536").End(xlUp).Row)
If TargetSht.Range("A1").Value = "" Then
SourceCol = 1
ElseIf TargetSht.Range("IV1").Value <> "" Then
MsgBox "There are no more columns available in the sheet " & TargetSht.Name, vbCritical, "No More Data Can Be Copied"
Exit Sub
Else
SourceCol = TargetSht.Range("IV1").End(xlToLeft).Column + 1
End If
TargetSht.Cells(1, SourceCol).Value = Format(Time)
SourceCells.Copy
TargetSht.Cells(2, SourceCol).PasteSpecial xlPasteValues
Application.OnTime Now + TimeValue("00:04:00"), "Data14"
Exit Sub
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top