![]() |
user form problem
I have a userform in a workbook and i want every time i fill in the form 1.to add a record in sheet1.xls (a1,b1.c1.d1.e1.and so on-in the same workbook) 2.and the same info in another sheet2.xls (b5,c8.d9 and so on ) and then print sheet2.xls
i know its a litlle bi tricky but can anyone help where can i find some userforms examples in the we |
user form problem
I guess your main problem is adding to the end.
Here is an example adding two textboxes to a sheet With ActiveWorkbook.Worksheets("Sheet1") cNextRow = .Cells(Rows.Count,"A").End(xlUp).Row + 1 .Range("A" & cNextRow).Value = Textbox1.Text .Range("B & cNextRow).Value = Textbox2Text End With This code would go in the userform module, triggered by a commandbutton say. Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "jimapos" wrote in message ... I have a userform in a workbook and i want every time i fill in the form 1.to add a record in sheet1.xls (a1,b1.c1.d1.e1.and so on-in the same workbook) 2.and the same info in another sheet2.xls (b5,c8.d9 and so on ) and then print sheet2.xls. i know its a litlle bi tricky but can anyone help? where can i find some userforms examples in the web |
user form problem
Thanks Bob for your help but there was an error on your answer. With ActiveWorkbook.Worksheets("Sheet1") cNextRow = .Cells(Rows.Count,"A").End(xlUp).Row + 1 .Range("A" & cNextRow).Value = Textbox1.Text .Range("B & cNextRow).Value = Textbox2.Text End With This code would go in the userform module, triggered by a commandbutton say. The last two lines give a red error ... Please sent me an example.xls with a userform if you can .If you cant ..thanks anyway. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
user form problem
Hi Jim,
Corrected the errors, and here it is tied to the commandbutton Private Sub CommandButton1_Click() Dim cNextRow As Long With ActiveWorkbook.Worksheets("Sheet1") cNextRow = .Cells(Rows.Count, "A").End(xlUp).Row + 1 .Range("A" & cNextRow).Value = TextBox1.Text .Range("B" & cNextRow).Value = TextBox2.Text End With End Sub -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "jim apos" wrote in message ... Thanks Bob for your help but there was an error on your answer. With ActiveWorkbook.Worksheets("Sheet1") cNextRow = .Cells(Rows.Count,"A").End(xlUp).Row + 1 .Range("A" & cNextRow).Value = Textbox1.Text .Range("B & cNextRow).Value = Textbox2.Text End With This code would go in the userform module, triggered by a commandbutton say. The last two lines give a red error ... Please sent me an example.xls with a userform if you can .If you cant .thanks anyway. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
All times are GMT +1. The time now is 10:33 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com