ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA question - Inputing data to txtbox in userform using short date formart (https://www.excelbanter.com/excel-programming/294910-vba-question-inputing-data-txtbox-userform-using-short-date-formart.html)

ajliaks[_2_]

VBA question - Inputing data to txtbox in userform using short date formart
 
Hi,

I intend to get data (in short date format "13-Apr-2004") using txtbo
in a userform.

I tried this code:

Private Sub txtSheet_Change()
' Guarda el numero de Sheet a Importar
Dim Sh As Variant
Sh = Format(txtSheet.Value, dd - mmm - yyyy)
MsgBox "Sheet value=" & Sh
End Sub

but MsgBox apperars inmediatly after each digit.

How can I make nothing appens until I get all the 11 digits, and ho
making sure that data will be only in short date format (dd-mmm-yyyy
?

Thanks

--
Message posted from http://www.ExcelForum.com


David Prout

VBA question - Inputing data to txtbox in userform using short date formart
 
You cannot gave the macro in the textbox.change as it will do exactly what you say. i.e. Each digit
is a change to the text box. One solution would be to add a command button to the form and move
your macro to work when the comman button is pressed

DavidP

On Tue, 13 Apr 2004 02:31:01 -0500, ajliaks wrote:

Hi,

I intend to get data (in short date format "13-Apr-2004") using txtbox
in a userform.

I tried this code:

Private Sub txtSheet_Change()
' Guarda el numero de Sheet a Importar
Dim Sh As Variant
Sh = Format(txtSheet.Value, dd - mmm - yyyy)
MsgBox "Sheet value=" & Sh
End Sub

but MsgBox apperars inmediatly after each digit.

How can I make nothing appens until I get all the 11 digits, and how
making sure that data will be only in short date format (dd-mmm-yyyy)
?

Thanks.


---
Message posted from http://www.ExcelForum.com/



Bob Phillips[_6_]

VBA question - Inputing data to txtbox in userform using short date formart
 
You could try the Exit or AfterUpdate events.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"ajliaks " wrote in message
...
Hi,

I intend to get data (in short date format "13-Apr-2004") using txtbox
in a userform.

I tried this code:

Private Sub txtSheet_Change()
' Guarda el numero de Sheet a Importar
Dim Sh As Variant
Sh = Format(txtSheet.Value, dd - mmm - yyyy)
MsgBox "Sheet value=" & Sh
End Sub

but MsgBox apperars inmediatly after each digit.

How can I make nothing appens until I get all the 11 digits, and how
making sure that data will be only in short date format (dd-mmm-yyyy)
?

Thanks.


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 10:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com