Format input box

M

Miree

With the help of lovely forum peeps i have a piece of code which includes

Response = InputBox("Formulation Number", vbOKCancel)

Is it possible to format the inputbox, as its a little big and looks silly.

I have never used a user form so dont really have a clue where to start there
 
T

The Code Cage Team

An Inputbox isn't a UserForm its one of Excels built in boxes and as such we
cannot format it, if you were to create a userform to look like an InputBox
then you could size that as needed.

Regards,
The Code Cage Team
www.thecodecage.com/forumz
 
T

The Code Cage Team

Create a userform with a textbox and a commanbutton on it, then in the sub
that you have the Inputbox remove that and use the line: Userform1.Show, this
will show the userform, double click the command button on the userform in
design mode (when you can see the userform you are creating in the VBE) the
module for the button will pop up and read Private Sub Commanbutton1_Click(),
add this code, Activesheet.Range("A1").Value = Me.Textbox1.Value
Unload Me
those 2 lines of code do gthis: 1st) puts the value of the textbox on the
form in A1 of the sheet that is currently visible, 2nd) unloads the userform,
it's ok to unload it as we aren't using it again until the next call
otherwise we could use the line Userform1.Hide.

Hope this helps.

Regards,
The Code Cage Team
www.thecodecage.com/forumz
 
Top