View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Billy Liddel Billy Liddel is offline
external usenet poster
 
Posts: 527
Default Message box question

The idea is to add the option button to the form:
Set the Caption to "Which Company to Bill" and the Tab Index to zero.

Set the the first option caption Co X, Name Opt X, TAb index 0.
Repeat for each company

The code goes in the Click button on the form.

Private Sub OKButton_Click()
' make sure the correct sheet is active
sheets("Sheet1").activate
' Determine the next empty row
NextRow =application.worksheetfunction.Counta(Range("A:A") )+1
' Transfer the rest of your data then

If OptX then cells(nextrow, Column) = "X"
if OptY then Cells(nextrow, Column) = "Y"
if OptZ then Cells(nextrow,Column)= "Z"

'clear the controls for next entry
' Your code to clear other text boxes then

OPtionUnkown = True
firstTextBox.setfocus ' I think it was StartTime

End Sub

Can you work with this?

Peter

"WH99" wrote:

Thanks Billy,
But I was after a vb code as I am using UserForms for this.
--
WH99


"Billy Liddel" wrote:

Why not try data Validation, assuming that you have a list of customers in
the sheet. Debra Dalgleish has great articles on Datathis subject. Start with:
http://www.contextures.com/xlDataVal01.html

Peter

"WH99" wrote:

I have a time sheet, the first six columns are headed as follows:

Hours Hours worked for company
Start time End time A B C D
18:00 03:00 09:00
18:00 03:00 09:00

Having inserted the Start and End times, I need a message box to pop up and
ask "which company to bill" and which ever is selected (by a option button)
the total would be inserted on the correct cell of the row your working on.

--
WH99