I am using the code below to paste data from a UserForm into a worksheet, however when I activate the procedure I get this error message ‘Run time error 424: Object Required’ with this line of code .Range("AG2").Value = TextBox31.Text
highlighted. Can you help me understand why I am getting the error message and how I can fix it?
Private Sub btnContinue_Click() With Sheets("Data Sheet") .Rows(2).Insert Shift:=xlDown .Range("A2").Value = Time .Range("B2").Value = Date .Range("C2").Value = TextBox1.Text .Range("D2").Value = TextBox2.Text .Range("E2").Value = TextBox3.Text .Range("F2").Value = TextBox4.Text .Range("G2").Value = TextBox5.Text .Range("H2").Value = TextBox6.Text .Range("I2").Value = TextBox7.Text .Range("J2").Value = TextBox8.Text .Range("K2").Value = TextBox9.Text .Range("L2").Value = TextBox10.Text .Range("M2").Value = TextBox11.Text .Range("N2").Value = TextBox12.Text .Range("O2").Value = TextBox13.Text .Range("P2").Value = TextBox14.Text .Range("Q2").Value = TextBox15.Text .Range("R2").Value = TextBox16.Text .Range("S2").Value = TextBox17.Text .Range("T2").Value = TextBox18.Text .Range("U2").Value = TextBox19.Text .Range("V2").Value = TextBox20.Text .Range("W2").Value = TextBox21.Text .Range("X2").Value = TextBox22.Text .Range("Y2").Value = TextBox23.Text .Range("Z2").Value = TextBox24.Text .Range("AA2").Value = TextBox25.Text .Range("AB2").Value = TextBox26.Text .Range("AC2").Value = TextBox27.Text .Range("AD2").Value = TextBox28.Text .Range("AE2").Value = TextBox29.Text .Range("AF2").Value = TextBox30.Text .Range("AG2").Value = TextBox31.Text End With End Sub
Last edited by EJensen; 09-04-2010 at 11:40 PM. Reason: SOLVED
Are you sure that TextBox31 actually exists - maybe its called something slightly different?
Martin
Eighty Twenty Spreadsheet Automation http://homepage.ntlworld.com/martin.rice1/ for all your Excel customisation and consulting needs.
If my solution has saved you time and/or money, please consider donating to Cancer Research UK.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks