VBA excel; Calculate the % utilisation

Lewisbwalsh

New Member
Joined
Feb 9, 2016
Messages
1
Hi i am stuck on this question for my application programming class in excel,


  1. Calculate the % utilisation for the whole timetable. Utilisation is the percentage of empties.
  2. You can use Find with blanks (nothing) but make sure to select the timetable range first so that you do not find blanks outside of that
I have been given a workbook.
Can someone please help or to even get it started.
Thank you
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hello,

I'm not sure of the structure of your workbook. So i mocked up the timetable below.
8vzp5e.jpg



There are a number of ways to achieve the same result i'm sure. The rudimentary VBA code structure i would use would be this:
Code:
Sub Utilisation()


Dim oData As Range
Dim oCells As Range
Dim eCount As Integer 'Counts how many blanks in the range
Dim tCount As Integer 'Counts total cells in range


'Set the range of the timetable (excluding headers)
Set oData = ActiveSheet.Range("B2", "H8")
'Initialise counters
eCount = 0
tCount = 0


For Each oCells In oData
    If oCells.Value = "" Then
        eCount = eCount + 1
        tCount = tCount + 1
    Else
        tCount = tCount + 1
    End If
Next oCells


MsgBox "Number of Empty Cells : " & eCount
MsgBox "Total Number of Cells : " & tCount


'Insert your calculation for utilisation here, using eCount and tCount


End Sub

Hope that Helps
Caleeco
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,605
Members
449,089
Latest member
Motoracer88

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