Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Holiday form


I have the following code that was created for me by somebody else:

Sub myFixLeave()
'Sheet module code, like: Sheet1!
'Work with button code.
Dim myHTimeLeft&, myAns, myShts$, myUser$, myActivSht$

'Get each sheet name.
myActivSht = ActiveSheet.Name
For Each ws In Worksheets

'Add each found sheet name to a string.
myShts = myShts & ws.Name & ", "

'Go back and get the next users sheet name.
Next ws

myUser = InputBox("Enter the User you will be working with below:"
vbLf & vbLf & "[ " & myShts & "]", "Get User!")
If myUser = "" Then GoTo myEnd

'This is the Sheet and cell that has the time left data, for that user

myHTimeLeft = Sheets(myUser).Range("K29").Value

'Show box to get leave wanted responce!
myAns = InputBox("You have: " & myHTimeLeft & _
" hrs. of holiday time left!" & vbLf & vbLf & _
"Enter the holiday time time you wish to take off:", _
"Use Holiday Leave Time!", myHTimeLeft)

'Load answer to that users sheet and data cell that gets the answer!
If myAns < xlNull And myAns <= myHTimeLeft Then
Sheets(myUser).Range("C5").Value = myAns

'Adjust Holiday leave for amount just taken on that users sheet!
Sheets(myUser).Range("K29").Value = Sheets(myUser).Range("K29").Value
myAns

'Test for taking more leave than you have!
ElseIf myAns < xlNull And myAns myHTimeLeft Then MsgBox "You do no
have, " & _
myAns & " hrs. of holiday leave left?" & vbLf & vbLf & _
"You have only, " & myHTimeLeft & " hrs. left!" & vbLf & vbLf & _
"You are, " & myAns - myHTimeLeft & " hrs. over your holiday leav
balance!", _
vbCritical + vbOKOnly, "Error: Exceeded your leave balance!"
End If

ActiveCell.Offset(0, 1).Select

myEnd:
End Sub

The code basically asks a user there name and amount of hours the
would like to take off, then posts that info to the users worksheet.
My question is - How would i change this so that, the input box ask
for a date when the amount of hours are chosen and then posts this dat
along with the amount of hours to the same row in a range on the user
sheet.
This would need to be posted to consecutive rows each time an entry i
made.

Any help would be greatly appreciated, and i would be incredibl
grateful

--
tugger
-----------------------------------------------------------------------
tuggers's Profile: http://www.excelforum.com/member.php...fo&userid=2900
View this thread: http://www.excelforum.com/showthread.php?threadid=53330

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Where can I get a good holiday booking form for my golf business? Dave Excel Discussion (Misc queries) 3 March 6th 10 04:58 AM
Holiday Farhad Excel Discussion (Misc queries) 2 October 29th 09 06:05 PM
how do I add words, holiday =1, holiday am=0.5 GCC Excel Worksheet Functions 2 March 6th 07 03:53 PM
Holiday Planner show holiday taken? Mac5 Excel Worksheet Functions 0 July 18th 06 11:29 PM
Holiday Pay johnrann New Users to Excel 5 July 17th 05 02:33 PM


All times are GMT +1. The time now is 04:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"