Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Format -Time Error on Excel 97

As soon as I thought I was done with my VBA programming, I get pulled
back in. I have UserForms which pull data from a selected row, the
staff then can update and edit the data to move to a Database....

However, now I find that when the data is pulled, all data is fine,
even the Data textbox (EDate), but the (ETime)textbox shows time as a
decimal (.375, rtc.) I have tried various forms of formatting such as:

ETime.Text = Format (Time, "hh:mm"), but I always get the same Compile
Error, Wrong number of arguments .....

This is very frustrating as I am very near finished. Thanks for any
help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Format -Time Error on Excel 97

? Format (Time, "hh:mm")
15:46


No reason it shouldn't work. Where is the code. The textbox isn't linked
to a cell is it?

--
Regards,
Tom Ogilvy

"Pete T" wrote in message
om...
As soon as I thought I was done with my VBA programming, I get pulled
back in. I have UserForms which pull data from a selected row, the
staff then can update and edit the data to move to a Database....

However, now I find that when the data is pulled, all data is fine,
even the Data textbox (EDate), but the (ETime)textbox shows time as a
decimal (.375, rtc.) I have tried various forms of formatting such as:

ETime.Text = Format (Time, "hh:mm"), but I always get the same Compile
Error, Wrong number of arguments .....

This is very frustrating as I am very near finished. Thanks for any
help.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Format -Time Error on Excel 97

Yes it is, I'm passing the value of a cell with an entry of time in
the cell, formatted hh:mm AMPM. The Textbox on the UserForm shows
..xxxxxxx (decimals for the time). Is that the problem? Is there
another format to use in that case?


"Tom Ogilvy" wrote in message ...
? Format (Time, "hh:mm")
15:46


No reason it shouldn't work. Where is the code. The textbox isn't linked
to a cell is it?

--
Regards,
Tom Ogilvy

"Pete T" wrote in message
om...
As soon as I thought I was done with my VBA programming, I get pulled
back in. I have UserForms which pull data from a selected row, the
staff then can update and edit the data to move to a Database....

However, now I find that when the data is pulled, all data is fine,
even the Data textbox (EDate), but the (ETime)textbox shows time as a
decimal (.375, rtc.) I have tried various forms of formatting such as:

ETime.Text = Format (Time, "hh:mm"), but I always get the same Compile
Error, Wrong number of arguments .....

This is very frustrating as I am very near finished. Thanks for any
help.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Format -Time Error on Excel 97

That is the way it behaves with a link and a time or date. I suggest you
break the link and update with code.

Private Sub Worksheet_Change(Target as Excel.Range)
if Target.Count 1 then exit sub
if Target.Address = "$B$5" then
ActiveSheet.OleObjects("TextBox1").Object.Value = Target.Text
end if
End if
End Sub

An easier approach might be to use a textbox from the drawing toolbar.

Place in on the sheet, select it and go to the formatting toolbar

put in

=B5 and enter

Replace B5 with the cell where the time value will be placed.

--
Regards,
Tom Ogilvy

"Pete T" wrote in message
om...
Yes it is, I'm passing the value of a cell with an entry of time in
the cell, formatted hh:mm AMPM. The Textbox on the UserForm shows
.xxxxxxx (decimals for the time). Is that the problem? Is there
another format to use in that case?


"Tom Ogilvy" wrote in message

...
? Format (Time, "hh:mm")
15:46


No reason it shouldn't work. Where is the code. The textbox isn't

linked
to a cell is it?

--
Regards,
Tom Ogilvy

"Pete T" wrote in message
om...
As soon as I thought I was done with my VBA programming, I get pulled
back in. I have UserForms which pull data from a selected row, the
staff then can update and edit the data to move to a Database....

However, now I find that when the data is pulled, all data is fine,
even the Data textbox (EDate), but the (ETime)textbox shows time as a
decimal (.375, rtc.) I have tried various forms of formatting such as:

ETime.Text = Format (Time, "hh:mm"), but I always get the same Compile
Error, Wrong number of arguments .....

This is very frustrating as I am very near finished. Thanks for any
help.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Format -Time Error on Excel 97

Thanks Tom I'll try that out. Thanks Again

PS: While in the UserForm -staff have requested comboboxes, I don't
know how to set those up. Do you have a short process for coding the
Comboboxes?

"Tom Ogilvy" wrote in message ...
That is the way it behaves with a link and a time or date. I suggest you
break the link and update with code.

Private Sub Worksheet_Change(Target as Excel.Range)
if Target.Count 1 then exit sub
if Target.Address = "$B$5" then
ActiveSheet.OleObjects("TextBox1").Object.Value = Target.Text
end if
End if
End Sub

An easier approach might be to use a textbox from the drawing toolbar.

Place in on the sheet, select it and go to the formatting toolbar

put in

=B5 and enter

Replace B5 with the cell where the time value will be placed.

--
Regards,
Tom Ogilvy

"Pete T" wrote in message
om...
Yes it is, I'm passing the value of a cell with an entry of time in
the cell, formatted hh:mm AMPM. The Textbox on the UserForm shows
.xxxxxxx (decimals for the time). Is that the problem? Is there
another format to use in that case?


"Tom Ogilvy" wrote in message

...
? Format (Time, "hh:mm")
15:46


No reason it shouldn't work. Where is the code. The textbox isn't

linked
to a cell is it?

--
Regards,
Tom Ogilvy

"Pete T" wrote in message
om...
As soon as I thought I was done with my VBA programming, I get pulled
back in. I have UserForms which pull data from a selected row, the
staff then can update and edit the data to move to a Database....

However, now I find that when the data is pulled, all data is fine,
even the Data textbox (EDate), but the (ETime)textbox shows time as a
decimal (.375, rtc.) I have tried various forms of formatting such as:

ETime.Text = Format (Time, "hh:mm"), but I always get the same Compile
Error, Wrong number of arguments .....

This is very frustrating as I am very near finished. Thanks for any
help.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Format -Time Error on Excel 97

I guess too much time had passed - you did say you were working on a
userform - so the drawing toolbar textbox is out. But as I suggested, break
the link and set the value with code.

You can do it in the userform initialize event

Private Sub Userform_Initialize()
Textbox1.Text = Worksheets("Sheet1").Range("B5").Text
End sub

the text value of the range will be formatted as it appears on the sheet.

For a combobox, set the rowsource to the range that contains the choices.
After that, the user makes a selection. If the selection includes dates,
you get the same problem with it not showing as a formatted date in the
textbox portion of the combobox - the list part will look fine.

You can use the click event to clean it up

Private Sub Combobox1_click()
Combobox1.Value = Format(combobox1.Value,"mm/dd/yyyy")
End sub

as an example.

--
Regards,
Tom Ogilvy

Pete T wrote in message
om...
Thanks Tom I'll try that out. Thanks Again

PS: While in the UserForm -staff have requested comboboxes, I don't
know how to set those up. Do you have a short process for coding the
Comboboxes?

"Tom Ogilvy" wrote in message

...
That is the way it behaves with a link and a time or date. I suggest

you
break the link and update with code.

Private Sub Worksheet_Change(Target as Excel.Range)
if Target.Count 1 then exit sub
if Target.Address = "$B$5" then
ActiveSheet.OleObjects("TextBox1").Object.Value = Target.Text
end if
End if
End Sub

An easier approach might be to use a textbox from the drawing toolbar.

Place in on the sheet, select it and go to the formatting toolbar

put in

=B5 and enter

Replace B5 with the cell where the time value will be placed.

--
Regards,
Tom Ogilvy

"Pete T" wrote in message
om...
Yes it is, I'm passing the value of a cell with an entry of time in
the cell, formatted hh:mm AMPM. The Textbox on the UserForm shows
.xxxxxxx (decimals for the time). Is that the problem? Is there
another format to use in that case?


"Tom Ogilvy" wrote in message

...
? Format (Time, "hh:mm")
15:46


No reason it shouldn't work. Where is the code. The textbox isn't

linked
to a cell is it?

--
Regards,
Tom Ogilvy

"Pete T" wrote in message
om...
As soon as I thought I was done with my VBA programming, I get

pulled
back in. I have UserForms which pull data from a selected row, the
staff then can update and edit the data to move to a Database....

However, now I find that when the data is pulled, all data is

fine,
even the Data textbox (EDate), but the (ETime)textbox shows time

as a
decimal (.375, rtc.) I have tried various forms of formatting such

as:

ETime.Text = Format (Time, "hh:mm"), but I always get the same

Compile
Error, Wrong number of arguments .....

This is very frustrating as I am very near finished. Thanks for

any
help.



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
How to type format time in decimal format & calculate time Cheyenne Excel Discussion (Misc queries) 1 February 13th 09 12:09 AM
Converting a time format to a String format in Excel Bill Partridge Excel Discussion (Misc queries) 3 October 3rd 07 11:48 AM
Excel VB Run-time error '50290' Bruce Blackman Excel Worksheet Functions 0 May 5th 05 02:26 PM
Run-time Error in Excel? Elena Excel Worksheet Functions 0 April 20th 05 04:26 PM
How to format cells in Excel for time in format mm:ss.00 Very Timely Excel Worksheet Functions 0 March 30th 05 07:35 AM


All times are GMT +1. The time now is 10:16 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"