Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default textbox data to worksheet

what code do i add to a commandbutton2 for the next?

they enter name and lastname in the textbox. when hitting commandbutton2 i
need that data from textbox1 in the next open cell sheet1 column c down. and
then command button disable. refresh either userform1 or listbox1
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default textbox data to worksheet

On Jan 12, 6:34*am, pswanie wrote:
what code do i add to a commandbutton2 for the next?

they enter name and lastname in the textbox. when hitting commandbutton2 i
need that data from textbox1 in the next open cell sheet1 column c down. and
then command button disable. refresh either userform1 or listbox1


try:
Private Sub CommandButton2_Click()
Dim i As String
Dim Lrow As Variant
Lrow = Sheets("Sheet1").Range("C65536").End(xlUp).Activat e
If TextBox1.Value < "" Then
ActiveCell.Value = TextBox1.Value
End If

End Sub
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default textbox data to worksheet

On Jan 12, 6:34*am, pswanie wrote:
what code do i add to a commandbutton2 for the next?

they enter name and lastname in the textbox. when hitting commandbutton2 i
need that data from textbox1 in the next open cell sheet1 column c down. and
then command button disable. refresh either userform1 or listbox1


Sorry use this one instead:

Private Sub CommandButton1_Click()
Dim i As String
Dim Lrow As Variant
Lrow = Sheets("Sheet1").Range("C65536").End(xlUp).Offset( 1,
0).Activate
If TextBox1.Value < "" Then
ActiveCell.Value = TextBox1.Value
End If
CommandButton1.Enabled = False

End Sub
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default textbox data to worksheet

i all ready got this macro in... and it works..

and cant get the one from gtvt06 to work...

please and thanx

Private Sub CommandButton1_Click()
Dim myStr As String
Dim iCtr As Long
Dim mySep As String
mySep = ", "
myStr = ""
With Me.ListBox1
For iCtr = 0 To .ListCount - 1
If .Selected(iCtr) = True Then
myStr = myStr & ", " & .List(iCtr)
End If
Next iCtr
End With

If myStr = "" Then
'nothing checked
Else
myStr = Mid(myStr, Len(mySep) + 1)
End If

Worksheets("sheet2").Range("d42").Value = myStr
Unload UserForm1
Sheets("DATA SHEET").Select
Range("A111").Select

End Sub


Private Sub UserForm_Initialize()
Dim myRng As Range
With Worksheets("sheet1")
Set myRng = .Range("c1", .Cells(.Rows.Count, "c").End(xlUp))
End With

With Me.ListBox1
.MultiSelect = fmMultiSelectMulti
.ListStyle = fmListStyleOption
.List = myRng.Value
End With
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default textbox data to worksheet

On Jan 12, 11:18*am, pswanie
wrote:
i all ready got this macro in... and it works..

and cant get the one from gtvt06 to work...

please and thanx

Private Sub CommandButton1_Click()
* * Dim myStr As String
* * Dim iCtr As Long
* * Dim mySep As String
* * mySep = ", "
* * myStr = ""
* * With Me.ListBox1
* * * * For iCtr = 0 To .ListCount - 1
* * * * * * If .Selected(iCtr) = True Then
* * * * * * * * myStr = myStr & ", " & .List(iCtr)
* * * * * * End If
* * * * Next iCtr
* * End With

* * If myStr = "" Then
* * * * 'nothing checked
* * Else
* * * * myStr = Mid(myStr, Len(mySep) + 1)
* * End If

* * Worksheets("sheet2").Range("d42").Value = myStr
* * Unload UserForm1
* * Sheets("DATA SHEET").Select
* * * * Range("A111").Select

End Sub

Private Sub UserForm_Initialize()
* * Dim myRng As Range
* * With Worksheets("sheet1")
* * * * Set myRng = .Range("c1", .Cells(.Rows.Count, "c").End(xlUp))
* * End With

* * With Me.ListBox1
* * * * .MultiSelect = fmMultiSelectMulti
* * * * .ListStyle = fmListStyleOption
* * * * .List = myRng.Value
* * End With
End Sub


did you change the sheet, button, textbox names and etc. on my code to
match your actual names?


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
Display Worksheet Range in a Textbox roadkill Excel Discussion (Misc queries) 1 October 19th 07 02:43 PM
TextBox value to hide a row in another worksheet TDC Excel Programming 1 March 19th 07 08:09 AM
How to retrieve data from worksheet to a textbox Carlos Excel Programming 1 March 15th 07 10:04 PM
put worksheet values into textbox on form thmort Excel Programming 2 July 17th 05 09:39 AM
I have had trouble with textbox text to worksheet Thomas Excel Discussion (Misc queries) 1 March 10th 05 03:23 AM


All times are GMT +1. The time now is 06:53 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"