Using userform, text boxes

G

Guest

Hi,

I'm using an excel help book to try and write a macro, well specifically a
userform part of a macro, the userform contains 40 text boxes and three
comand buttons, i have created the userform, but as usual the book macro
varies quite a lot from the macro i am trying to write, i have declared my
variables, created a spreadsheet with my variables, (default and current)
with named ranges for selection of the required cell. the stage i am at with
the code i have written i would expect when i run my macro for the userform
to open displaying the default data in the text boxes but instead i get an
error message with a debug option (line highlighted with a ** below)


***********************************(Module 1)

Public CC1 'Cost Centre 1
Public CC2 'Cost Centre 2
Public CC3 'Cost Centre 3
Public CC4 'Cost Centre 4


Sub CCOptions()
' Userform 1(Cost Centre) options

With Worksheets("MacroDAta")

CC1 = .Range("CC1_ default").Value
CC2 = .Range("CC2_ default").Value
CC3 = .Range("CC3_ default").Value
CC4 = .Range("CC4_ default").Value
End With

With UserForm1

** CC1TextBox.Vale = CC1**
CC2TextBox.Value = CC2
CC3TextBox.Value = CC3
CC4TextBox.Value = CC4

End With

UserForm1.Show

End Sub
*********************************

*********************************(Microsoft Excel objects(Sheet 1))


Sub upload()

LoadVariables 'Load Public Variables

End Sub

Private Sub CommandButton1_Click()

CommandButton1.Caption = "P r i n t A l l"

CCOptions

End Sub
***************************************

That is all my code thus far, (i have cut it down was CC1 to CC45, i dont
understand where i'm going wrong thus far (plus the userform sheet, text
boxes labelled CC1textbox, etc), please any help,

thanks

Andy
 
G

Guest

quick note, error isn't because i have spelt value wrong, that is something
i have done while trying to solve the problem.

Thanks

Andy
 
J

Jean-Yves

Hi,

Missing dot ?=> .CC1TextBox.Vale = CC1
Typing mistake : .CC1TextBox.ValUe = CC1
Regards,
JY
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top