Professional Documents
Culture Documents
Objective
The following assignment aims at capturing the back end activities of
transaction driven websites, where people can book appointments or
tickets. The example that has been considered in this assignment is the
worlds second largest healthtech start-up Practo.
Sheet 1- DATA
The data for the exercise was gathered from their website
https://www.practo.com/. While Practo has its services across various
cities and countries, for simplicity, only one Locality is considered in this
exercise, viz. Bangalore. Few physician primary type and the sub
specialisations that are listed on the website have been considered for this
exercise. For each of the specialisations, few doctors with respective
specialisations are considered (shown in Data sheet).
Sheet 2- FIND AND BOOK
The Sheet Find and Book acts as a User Interface. The users can find
and book appointments as per their desired data and time of
appointment. They can also select the physician or hospital they would
like to consult in the desired speciality using the dropdown menu. On
filling in the required details, the user can submit the form by clicking the
Submit button, for booking their appointment.
In the back-end, when any user submits the form their appointment
details get appended to a table, where all appointments are recorded,
which is accessible only by the database administrator of that website. For
these details to be transferred from the form to the table, a Macro named
table is used.
The VBA code for the aforementioned macros isSub table()
'
' table Macro
'
'
Application.ScreenUpdating = False
Sheets("Find and Book ").Select
Range("C7").Select
Selection.Copy
Sheets("Admin").Select
Range("B2").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Sheets("Find and Book ").Select
ActiveCell.Offset(2, 0).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Admin").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Sheets("Find and Book ").Select
ActiveCell.Offset(2, 0).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Admin").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Sheets("Find and Book ").Select
ActiveCell.Offset(3, -1).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Admin").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Sheets("Find and Book ").Select
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 3
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 6
ActiveWindow.ScrollRow = 7
ActiveWindow.ScrollRow = 8
ActiveWindow.ScrollRow = 9
ActiveCell.Offset(4, 0).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Admin").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Sheets("Find and Book ").Select
ActiveCell.Offset(4, 0).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Admin").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Sheets("Find and Book ").Select
Application.CutCopyMode = False
Selection.ClearContents
ActiveCell.Offset(-4, 0).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(-4, 0).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(-3, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(-2, 0).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(-2, 0).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(-6, -1).Range("A1").Select
ActiveWindow.ScrollRow = 1
End Sub
Sheet 4- APPOINTMENTS
This sheet ideally displays all the appointments on the day the viewer is
viewing the table. A problem with the previous macro is that it does not
just update the table, rather again displays all the appointments as of that
day, without removing the duplicates. Hence, the macro update_table is
used. On clicking the button Update Appointments, all duplicates are
removed and all the bookings are sorted according to the time of their
appointments for that date. The VBA code of the aforementioned
macro is as follows:
Sub update_table()
'
' update_table Macro
'
'
Application.ScreenUpdating = False
Range("B4").Select
Range(Selection, Selection.End(xlToRight)).Select
Range("B4:G50").Select
ActiveSheet.Range("$B$4:$G$50").RemoveDuplicates Columns:=3,
Header:=xlYes
ActiveWorkbook.Worksheets("Appointments").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Appointments").Sort.SortFields.Add
Key:=Range( _
"C5:C50"), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Appointments").Sort
.SetRange Range("B4:G50")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("B4:B32").Select
Selection.AutoFilter
ActiveSheet.Range("$B$4:$B$32").AutoFilter Field:=1, Criteria1:= _
xlFilterToday, Operator:=xlFilterDynamic
Range("B4:G51").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Range("H12").Select
End Sub
Again, this VBA code was generated as a result of manually executing a
macro based on my requirements. The macro involves removing
duplicates based on name, sorting the list based on time and filtering the
list for todays date.
This final table Todays Appointments can help in blocking the respective
doctors calendars for the day.
References
[1]. https://www.practo.com/
[2]. http://www.mrexcel.com/forum/excel-questions/715128-visual-basicapplications-copy-paste-entire-row-second-sheet-based-cell-value.html
[3]. http://www.exceltrainingvideos.com/copy-data-to-another-excelworkbook-based-on-criteria-using-vba/