Run time Error - Application Defined or Object Defined Error Excel Vba

Joined
Dec 9, 2015
Messages
1
Reaction score
0
Hello,
I came across an error application defined or object define error for the following codes. This code will be fine if i add the text box fields to the cell.But when i want to modify or edit the cells the above mentioned error occurs

Public Emp As Integer
Public iRow As Integer
Public ws As Worksheet

Sub initialize()
Call get_Next_Emp
UserForm6.ComboBox3.Clear
UserForm6.ComboBox3.Clear
UserForm6.OptionButton3.Value = 1
End Sub
Sub get_Next_Emp()
Dim ws As Worksheet
Set ws = Worksheets("Issued")
If ws.Range("A6").Value = "" Then
Emp = 1000
ElseIf ws.Range("A7").Value = "" Then
Emp = 1001
Else
ws.Activate
ws.Range("A6").Copy
Emp = ws.Range("A" & ws.Range(selection, selection.End(xlDown)).Cells.count + 5).Value + 1
End If
End Sub
Sub populate_value(iRow As Integer)
Dim ws As Worksheet

Set ws = Worksheets("Issued")
ws.Cells(iRow, 1).Value = UserForm6.TextBox1.Value
ws.Cells(iRow, 5).Value = UserForm6.ComboBox1.Value
ws.Cells(iRow, 7).Value = UserForm6.ComboBox2.Value
ws.Cells(iRow, 2).Value = UserForm6.TextBox2.Value
ws.Cells(iRow, 4).Value = UserForm6.TextBox4.Value
ws.Cells(iRow, 6).Value = UserForm6.TextBox5.Value
ws.Cells(iRow, 7).Value = UserForm6.ComboBox2.Value
ws.Cells(iRow, 8).Value = UserForm6.TextBox6.Value
ws.Cells(iRow, 9).Value = UserForm6.TextBox7.Value
ws.Cells(iRow, 3).Value = UserForm6.ComboBox3.Value
 

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