Half hour entry

vmjan02

Well-known Member
Joined
Aug 15, 2012
Messages
1,051
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
I have a sheet as ARE Raw which has all the records in it. This has the skill number in a half hourly interval.

I have the list of records as Skill number in a column C. and in total there are 119 unique skill numbers.
I am not sure is there a code as it will take Max and Min time from the raw report ARE Raw sheet and will create a sheet which will have all the 119 unqiue skill number with half hourly interval a as 0:00 to 23:30 is the time.

ref the table below

SkillNumTime
21000:00
21000:30
21001:00
21001:30
21002:00
21002:30
21010:00
21010:30
21011:00
21011:30
21012:00
21012:30
21013:00
21013:30
21020:00
21020:30
21021:00
21021:30
21022:00
21022:30
21023:00
21023:30
21030:00
21030:30
21031:00
21031:30
21032:00
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
paste the code below into vba module,
it reads all skills from the SKILLS sheet,
then builds the grid of 1/2 hour for each.

run: CreateTimeSlots

Code:
Option Explicit
Public gcolSkills As Collection, gcolTime As Collection

'-------------------
Sub CreateTimeSlots()
LoadSkills
LoadTime
CreateTimeGrid

Set gcolSkillsh = Nothing
Set gcolTime = Nothing
End Sub


'-------------------
Private Sub LoadSkills()
Dim sSkill As String
  'get all the skills
Set gcolSkills = New Collection
Sheets("skills").Activate
Range("A2").Select
While ActiveCell.Value <> ""
   sSkill = ActiveCell.Value
   gcolSkills.Add sSkill, sSkill
  
   ActiveCell.Offset(1, 0).Select 'next row
Wend
End Sub

'-------------------
Private Sub CreateTimeGrid()
Dim s, t
Dim sSkill As String
Sheets("results").Activate
Cells.Clear
Range("A1").Value = "skill"
Range("b1").Value = "time"
Range("A2").Select
For s = 1 To gcolSkills.Count
   sSkill = gcolSkills(s)
   For t = 1 To gcolTime.Count
       ActiveCell.Offset(0, 0).Value = sSkill
       ActiveCell.Offset(0, 1).Value = gcolTime(t)
      
       ActiveCell.Offset(1, 0).Select 'next row
   Next
Next

End Sub

'-------------------
Private Sub LoadTime()
Dim vTime As Date, vLastTime As Date
vLastTime = "23:55"
vTime = "00:00"
Set gcolTime = New Collection
While vTime < vLastTime
   gcolTime.Add vTime
   vTime = DateAdd("n", 30, vTime)
Wend
'Beep
End Sub
 
Upvote 0
I am getting error Compile Error

on this line

Set gcolSkillsh = Nothing
 
Upvote 0

Forum statistics

Threads
1,214,386
Messages
6,119,220
Members
448,876
Latest member
Solitario

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