Hello,
I am an excel beginner trying to make a UserForm for data entry. I made the UserForm and had it working, then accidentally saved the file as the wrong format and had to make a brand new one.
I was able to copy the code and add it into my new VBA with all the same box names, but now when i run it I get a pop-up that says "Run-time error 424: Object Required."
Unfortunately there's no Debugger that highlights the error when this happens, so I have no idea.
If anybody could help I'd greatly appreciate it!. Code below:
Private Sub CancelButton_Click()
Unload Me
End Sub
Private Sub ClearButton_Click()
Call UserForm_Initialize
End Sub
Private Sub SubmitButton_Click()
Dim emptyRow As Long
Sheet1.Activate
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
Cells(emptyRow, 1).Value = First.Value
Cells(emptyRow, 2).Value = Middle.Value
Cells(emptyRow, 3).Value = Surname.Value
Cells(emptyRow, 4).Value = Age.Value
Cells(emptyRow, 5).Value = Village.Value
Cells(emptyRow, 6).Value = MonthBox.Value
Cells(emptyRow, 7).Value = DayBox.Value
Cells(emptyRow, 8).Value = YearBox.Value
Cells(emptyRow, 10).Value = HeightBox.Value
Cells(emptyRow, 11).Value = Weight.Value
Cells(emptyRow, 12).Value = Pulse.Value
Cells(emptyRow, 13).Value = Systolic.Value
Cells(emptyRow, 14).Value = Diastolic.Value
Cells(emptyRow, 16).Value = Dx1.Value
Cells(emptyRow, 17).Value = Dx2.Value
Cells(emptyRow, 18).Value = Dx3.Value
Cells(emptyRow, 19).Value = Dx4.Value
Cells(emptyRow, 20).Value = Dx5.Value
Cells(emptyRow, 21).Value = Dx6.Value
Cells(emptyRow, 22).Value = Dx7.Value
Cells(emptyRow, 23).Value = Dx8.Value
Cells(emptyRow, 24).Value = Dx9.Value
Cells(emptyRow, 25).Value = Dx10.Value
Cells(emptyRow, 26).Value = Rx1.Value
Cells(emptyRow, 27).Value = Rx2.Value
Cells(emptyRow, 28).Value = Rx3.Value
Cells(emptyRow, 29).Value = Rx4.Value
Cells(emptyRow, 30).Value = Rx5.Value
Cells(emptyRow, 31).Value = Rx6.Value
Cells(emptyRow, 32).Value = Rx7.Value
Cells(emptyRow, 33).Value = Rx8.Value
Cells(emptyRow, 34).Value = Rx9.Value
Cells(emptyRow, 35).Value = Rx10.Value
End Sub
Private Sub UserForm_Click()
End Sub
Private Sub UserForm_Initialize()
First.Value = ""
Middle.Value = ""
Surname.Value = ""
Age.Value = ""
Village.Value = ""
MonthBox.Value = ""
DayBox.Value = ""
YearBox.Value = ""
HeightBox.Value = ""
Weight.Value = ""
Pulse.Value = ""
Systolic.Value = ""
Diastolic.Value = ""
Dx1.Value = ""
Dx2.Value = ""
Dx3.Value = ""
Dx4.Value = ""
Dx5.Value = ""
Dx6.Value = ""
Dx7.Value = ""
Dx8.Value = ""
Dx9.Value = ""
Dx10.Value = ""
Rx1.Value = ""
Rx2.Value = ""
Rx3.Value = ""
Rx4.Value = ""
Rx5.Value = ""
Rx6.Value = ""
Rx7.Value = ""
Rx8.Value = ""
Rx9.Value = ""
Rx10.Value = ""
First.SetFocus
End Sub
I am an excel beginner trying to make a UserForm for data entry. I made the UserForm and had it working, then accidentally saved the file as the wrong format and had to make a brand new one.
I was able to copy the code and add it into my new VBA with all the same box names, but now when i run it I get a pop-up that says "Run-time error 424: Object Required."
Unfortunately there's no Debugger that highlights the error when this happens, so I have no idea.
If anybody could help I'd greatly appreciate it!. Code below:
Private Sub CancelButton_Click()
Unload Me
End Sub
Private Sub ClearButton_Click()
Call UserForm_Initialize
End Sub
Private Sub SubmitButton_Click()
Dim emptyRow As Long
Sheet1.Activate
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
Cells(emptyRow, 1).Value = First.Value
Cells(emptyRow, 2).Value = Middle.Value
Cells(emptyRow, 3).Value = Surname.Value
Cells(emptyRow, 4).Value = Age.Value
Cells(emptyRow, 5).Value = Village.Value
Cells(emptyRow, 6).Value = MonthBox.Value
Cells(emptyRow, 7).Value = DayBox.Value
Cells(emptyRow, 8).Value = YearBox.Value
Cells(emptyRow, 10).Value = HeightBox.Value
Cells(emptyRow, 11).Value = Weight.Value
Cells(emptyRow, 12).Value = Pulse.Value
Cells(emptyRow, 13).Value = Systolic.Value
Cells(emptyRow, 14).Value = Diastolic.Value
Cells(emptyRow, 16).Value = Dx1.Value
Cells(emptyRow, 17).Value = Dx2.Value
Cells(emptyRow, 18).Value = Dx3.Value
Cells(emptyRow, 19).Value = Dx4.Value
Cells(emptyRow, 20).Value = Dx5.Value
Cells(emptyRow, 21).Value = Dx6.Value
Cells(emptyRow, 22).Value = Dx7.Value
Cells(emptyRow, 23).Value = Dx8.Value
Cells(emptyRow, 24).Value = Dx9.Value
Cells(emptyRow, 25).Value = Dx10.Value
Cells(emptyRow, 26).Value = Rx1.Value
Cells(emptyRow, 27).Value = Rx2.Value
Cells(emptyRow, 28).Value = Rx3.Value
Cells(emptyRow, 29).Value = Rx4.Value
Cells(emptyRow, 30).Value = Rx5.Value
Cells(emptyRow, 31).Value = Rx6.Value
Cells(emptyRow, 32).Value = Rx7.Value
Cells(emptyRow, 33).Value = Rx8.Value
Cells(emptyRow, 34).Value = Rx9.Value
Cells(emptyRow, 35).Value = Rx10.Value
End Sub
Private Sub UserForm_Click()
End Sub
Private Sub UserForm_Initialize()
First.Value = ""
Middle.Value = ""
Surname.Value = ""
Age.Value = ""
Village.Value = ""
MonthBox.Value = ""
DayBox.Value = ""
YearBox.Value = ""
HeightBox.Value = ""
Weight.Value = ""
Pulse.Value = ""
Systolic.Value = ""
Diastolic.Value = ""
Dx1.Value = ""
Dx2.Value = ""
Dx3.Value = ""
Dx4.Value = ""
Dx5.Value = ""
Dx6.Value = ""
Dx7.Value = ""
Dx8.Value = ""
Dx9.Value = ""
Dx10.Value = ""
Rx1.Value = ""
Rx2.Value = ""
Rx3.Value = ""
Rx4.Value = ""
Rx5.Value = ""
Rx6.Value = ""
Rx7.Value = ""
Rx8.Value = ""
Rx9.Value = ""
Rx10.Value = ""
First.SetFocus
End Sub