VBA Script in Excel

  • Thread starter Thread starter k1appy
  • Start date Start date
K

k1appy

Good morning all,

I am after a bit of (probably) simple VBA script for the following:

Basically, I am creating a spreadsheet that will be used as a "Holiday
Booking Form"

It has 5 drop down boxes with information in such as Day, Month, Date,
Time From & Time To. There are also 2 buttons "Book" & "Cancel"

what I need is help with the VBA code to make it possible to choose a
date and time for the holiday, press BOOK and for the details to appear
in a cell(s) below, ideally I would like the CANCEL button make the
pre-booked holiday appear in a different colour.

If anyone can help at all or point me in the right direction, it'd be
much appreciated!!!

Cheers in advance all!!

J
 
Sub Btn_Click()
Dim rng as Range
set rng = Cells(rows.count,1).end(xlup)(2)
rng(1,1).Value = Activesheet.Dropdowns("Drop Down 1").Value
rng(1,2).Value = Activesheet.DropDowns("Drop Down 2").Value
' and so forth

End Sub

Sub Btn1_Click()
Dim rng as Range
With Activesheet
set rng = .Range(cells(2,1),Cells(rows.count,1).End(xlup)
End with
for each cell in rng
if cell.Value = Activesheet.Dropdowns("Drop Down 1").Value and _
cell.offset(0,1).Value = Activehsheet.DropDowns("Drop Down 2).Value and
_
cell.offset(0,2).Value = Activesheet.DropDowns("Drop Down 3).Value and
_
' so forth then
cell.Resize(1,5).Font.ColorIndex = 5
exit for
End if
Next
End Sub

would be some pseudo code that should get you started.
 
Back
Top