Cant load my user form - Subscript out of range

MCE2014

New Member
Joined
Sep 15, 2014
Messages
21
Hi,

I keep getting a runtime error 9 - subscript out of range on this one line:

Private Sub btnaddjob_Click()

frmDefects.Show

Dim B1 As Button
B1 = ActiveSheet.Buttons("btnclose")

B1.Font.ColorIndex = 15
B1.Enabled = False

End Sub

There is no misspelling of the name and I have a userform called frmDefects in my collection.

Cannot figure out why it will not accept this simple command

Anyone got any ideas???
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hi MCE2014,

I'm sure that posted code doesn't have any problem. A code line in the form frmDefects has an error and it's a runtime error so it occur when the procedure is executed. Please check the cod ein frmDefects.
 
Upvote 0
Hi MCE2014,

I'm sure that posted code doesn't have any problem. A code line in the form frmDefects has an error and it's a runtime error so it occur when the procedure is executed. Please check the cod ein frmDefects.


Ah I see,

I'm out of office now so I will check frmDefects tomorrow morning for
errors.

Thanks for the reply. :)
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,432
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top