View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
shivboy[_11_] shivboy[_11_] is offline
external usenet poster
 
Posts: 1
Default Out of Subscript error while opening a Userform


Sorry for not posting the code. Here it is:


Code:
--------------------

Private Sub btnShowiForm_Click()
newForm.Show
End Sub

Private Sub UserForm_Initialize()
Dim stateName() As String
stateName(0) = "A"
stateName(1) = "B"
stateName(2) = "C"
stateName(3) = "D"
stateName(4) = "E"
stateName(5) = "F"
Dim i As Integer
With cbSelState
.Clear
For i = 0 To UBound(stateName)
.AddItem (stateName(i))
Next i
End With
End Sub


--------------------


Please tell me where I am going wrong. I am somehow not able to figure
out the error.

I tried changing the TakeFocusOnClick property of the button, but still
it generated the error.

papou Wrote:
Hello
Since you don't give much details, I would suggest you check for the
TakeFocusOnClick property of your button on your worksheet.
Set this property on False.

HTH
Cordially
Pascal

"shivboy" a
écrit
dans le message de news:
...

Hi,

I am getting a "Error '9' : Subscript out of range" error while

opening
a user form from a button on a sheet. Why is this happening? I

checked
for typo errors, but there aren't any. What do I do?

Peace,

Shivboy


--
shivboy

------------------------------------------------------------------------
shivboy's Profile:
http://www.excelforum.com/member.php...o&userid=35137
View this thread:

http://www.excelforum.com/showthread...hreadid=553956



--
shivboy
------------------------------------------------------------------------
shivboy's Profile: http://www.excelforum.com/member.php...o&userid=35137
View this thread: http://www.excelforum.com/showthread...hreadid=553956