marks97
asked on
Validation and Combo box question
Hi. Im just starting to use Visual Basic for a school project so my skills are limited to say the least. The VB I am using is only the version in Excel so it is not very powerful. It has taken me a good few days to get to where I am but now I am stuck so was wondering if any of you guys could help me. I have 3 questions. The first is:
Is there a way to force people to only be able to enter letters and all symbols such as [?!"#$%^&*()>.] but no numbers into a textbox in excel VBA.
The second is:
Is there a way to use a combo box in a UserForm that by the selection you make, determines which UserForm you go to. e.g. if i select 1 from the combo box, it takes me to UserForm 1 or if I select 2 from the combo box it takes me to UserForm2.
The third is:
Is there a way to get TextBoxes that are linked to a cell in Excel to reveal what the cell value is in the TextBox without having to put the cursor in the TextBox first. The Code I use currently to link to the cells is:
TextBox1.Text = Range("cell").Value
These are probably very basic questions but i cant find a way to do them and have searched lots of forums looking for the answer. Any help you can provide will be greatly appreciated.
Mark Thurley
Is there a way to force people to only be able to enter letters and all symbols such as [?!"#$%^&*()>.] but no numbers into a textbox in excel VBA.
The second is:
Is there a way to use a combo box in a UserForm that by the selection you make, determines which UserForm you go to. e.g. if i select 1 from the combo box, it takes me to UserForm 1 or if I select 2 from the combo box it takes me to UserForm2.
The third is:
Is there a way to get TextBoxes that are linked to a cell in Excel to reveal what the cell value is in the TextBox without having to put the cursor in the TextBox first. The Code I use currently to link to the cells is:
TextBox1.Text = Range("cell").Value
These are probably very basic questions but i cant find a way to do them and have searched lots of forums looking for the answer. Any help you can provide will be greatly appreciated.
Mark Thurley
Second Question
Private sub Combo1_Click
if Combo = 1 then
Form1.visible = true
Form.visible = false
end if
if Combo=2 then
Form2.visible = true
Form.visible = false
end if
end sub
Private sub Combo1_Click
if Combo = 1 then
Form1.visible = true
Form.visible = false
end if
if Combo=2 then
Form2.visible = true
Form.visible = false
end if
end sub
Don't look at question 2. It is wrong. I will tell you tomorrow morning how to do it if it hasn't been answered by then.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your help.
if isNumeric (text1.text) then
call msgbox("You can not enter nubers",vbinformation)
end if
Probably do this in the text_change event