Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Form Problem ??? mully New Users to Excel 5 July 2nd 08 11:53 AM
User form problem Freshman Excel Worksheet Functions 3 November 6th 06 05:54 PM
User Form Problem DCSwearingen Excel Discussion (Misc queries) 2 December 30th 05 03:42 PM
User Form Problem DCSwearingen Excel Discussion (Misc queries) 0 December 29th 05 11:04 PM
problem with user form chris[_3_] Excel Programming 1 July 15th 03 03:40 AM


All times are GMT +1. The time now is 08:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"