Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default put textbox data in sheet (sheet name selected in a listbox)

i got a listbox to list all sheets in workbook.

1) only select one sheettab
2) when user click commandbutton3 put data in the selected sheet
3)not in cell n9 but next open cell in column 9


Private Sub CommandButton3_Click()

myStr = ""

With Me.ListBox1
For iCtr = 0 To .ListCount - 1
If .Selected(iCtr) = True Then
myStr = myStr & ", " & .List(iCtr)
End If
Next
End With

If myStr = "" Then
'nothing checked

MsgBox "Please Select the month this data needs to go to" '& _
''vbNewLine & "If the Name does not appear then add it"
Else
'TextBox7.Value = Format(TextBox7.Value, "##:##")
Range("n9").Value = TextBox7.Value



'myStr = Mid(myStr, Len(mySep) + 1)
End If


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default put textbox data in sheet (sheet name selected in a listbox)

hi
not sure. column 9 is column I. do you mean column N??
anyway try this....
change this line....
Range("n9").Value = TextBox7.Value
to...
Range("N65000").end(xlup).offset(1,0).value = textbox7.value
or
Range("N1").end(xldown).offset(1,0).value = textbox1.value

regards
FSt1

"pswanie" wrote:

i got a listbox to list all sheets in workbook.

1) only select one sheettab
2) when user click commandbutton3 put data in the selected sheet
3)not in cell n9 but next open cell in column 9


Private Sub CommandButton3_Click()

myStr = ""

With Me.ListBox1
For iCtr = 0 To .ListCount - 1
If .Selected(iCtr) = True Then
myStr = myStr & ", " & .List(iCtr)
End If
Next
End With

If myStr = "" Then
'nothing checked

MsgBox "Please Select the month this data needs to go to" '& _
''vbNewLine & "If the Name does not appear then add it"
Else
'TextBox7.Value = Format(TextBox7.Value, "##:##")
Range("n9").Value = TextBox7.Value



'myStr = Mid(myStr, Len(mySep) + 1)
End If


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default put textbox data in sheet (sheet name selected in a listbox)

yip sorry needs to be column N.

that code worked fine and i got my textboxes 1 to 9 linked.

now. how will i get my code to put the data in the page from the listbox
where i select the page name? how will i get to sellect only one page at a
time in this listbox?

"FSt1" wrote:

hi
not sure. column 9 is column I. do you mean column N??
anyway try this....
change this line....
Range("n9").Value = TextBox7.Value
to...
Range("N65000").end(xlup).offset(1,0).value = textbox7.value
or
Range("N1").end(xldown).offset(1,0).value = textbox1.value

regards
FSt1

"pswanie" wrote:

i got a listbox to list all sheets in workbook.

1) only select one sheettab
2) when user click commandbutton3 put data in the selected sheet
3)not in cell n9 but next open cell in column 9


Private Sub CommandButton3_Click()

myStr = ""

With Me.ListBox1
For iCtr = 0 To .ListCount - 1
If .Selected(iCtr) = True Then
myStr = myStr & ", " & .List(iCtr)
End If
Next
End With

If myStr = "" Then
'nothing checked

MsgBox "Please Select the month this data needs to go to" '& _
''vbNewLine & "If the Name does not appear then add it"
Else
'TextBox7.Value = Format(TextBox7.Value, "##:##")
Range("n9").Value = TextBox7.Value



'myStr = Mid(myStr, Len(mySep) + 1)
End If


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default put textbox data in sheet (sheet name selected in a listbox)

hi
try something like this in the list box code.
Private Sub ListBox1_Click()
Worksheets(ListBox1.Text).Activate
End Sub

regards
FSt1

"pswanie" wrote:

yip sorry needs to be column N.

that code worked fine and i got my textboxes 1 to 9 linked.

now. how will i get my code to put the data in the page from the listbox
where i select the page name? how will i get to sellect only one page at a
time in this listbox?

"FSt1" wrote:

hi
not sure. column 9 is column I. do you mean column N??
anyway try this....
change this line....
Range("n9").Value = TextBox7.Value
to...
Range("N65000").end(xlup).offset(1,0).value = textbox7.value
or
Range("N1").end(xldown).offset(1,0).value = textbox1.value

regards
FSt1

"pswanie" wrote:

i got a listbox to list all sheets in workbook.

1) only select one sheettab
2) when user click commandbutton3 put data in the selected sheet
3)not in cell n9 but next open cell in column 9


Private Sub CommandButton3_Click()

myStr = ""

With Me.ListBox1
For iCtr = 0 To .ListCount - 1
If .Selected(iCtr) = True Then
myStr = myStr & ", " & .List(iCtr)
End If
Next
End With

If myStr = "" Then
'nothing checked

MsgBox "Please Select the month this data needs to go to" '& _
''vbNewLine & "If the Name does not appear then add it"
Else
'TextBox7.Value = Format(TextBox7.Value, "##:##")
Range("n9").Value = TextBox7.Value



'myStr = Mid(myStr, Len(mySep) + 1)
End If


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default put textbox data in sheet (sheet name selected in a listbox)

no that does nothing if i use it like that.. i can still select more than one
sheet name

i tried to but it in my commandbutton3_click but get a error

"FSt1" wrote:

hi
try something like this in the list box code.
Private Sub ListBox1_Click()
Worksheets(ListBox1.Text).Activate
End Sub

regards
FSt1

"pswanie" wrote:

yip sorry needs to be column N.

that code worked fine and i got my textboxes 1 to 9 linked.

now. how will i get my code to put the data in the page from the listbox
where i select the page name? how will i get to sellect only one page at a
time in this listbox?

"FSt1" wrote:

hi
not sure. column 9 is column I. do you mean column N??
anyway try this....
change this line....
Range("n9").Value = TextBox7.Value
to...
Range("N65000").end(xlup).offset(1,0).value = textbox7.value
or
Range("N1").end(xldown).offset(1,0).value = textbox1.value

regards
FSt1

"pswanie" wrote:

i got a listbox to list all sheets in workbook.

1) only select one sheettab
2) when user click commandbutton3 put data in the selected sheet
3)not in cell n9 but next open cell in column 9


Private Sub CommandButton3_Click()

myStr = ""

With Me.ListBox1
For iCtr = 0 To .ListCount - 1
If .Selected(iCtr) = True Then
myStr = myStr & ", " & .List(iCtr)
End If
Next
End With

If myStr = "" Then
'nothing checked

MsgBox "Please Select the month this data needs to go to" '& _
''vbNewLine & "If the Name does not appear then add it"
Else
'TextBox7.Value = Format(TextBox7.Value, "##:##")
Range("n9").Value = TextBox7.Value



'myStr = Mid(myStr, Len(mySep) + 1)
End If




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default put textbox data in sheet (sheet name selected in a listbox)

this is the code i got now

it list all the sheets but i only want one sheet at a time selected and then
the data in textbox1 thru textbox9 needs go in the selected sheet if the
cells next to todays date is empty. (to prevent them from entering data
twice on one day)

Private Sub CommandButton3_Click()

myStr = ""

With Me.ListBox1
For iCtr = 0 To .ListCount - 1
If .Selected(iCtr) = True Then
myStr = myStr & ", " & .List(iCtr)
End If
Next
End With

If myStr = "" Then
'nothing checked

MsgBox "Please Select the month this data needs to go to"

Else


Range("o65000").End(xlUp).Offset(1, 0).Value = TextBox1.Value
Range("p65000").End(xlUp).Offset(1, 0).Value = TextBox2.Value
Range("q65000").End(xlUp).Offset(1, 0).Value = TextBox3.Value
Range("r65000").End(xlUp).Offset(1, 0).Value = TextBox4.Value
Range("s65000").End(xlUp).Offset(1, 0).Value = TextBox5.Value
Range("t65000").End(xlUp).Offset(1, 0).Value = TextBox6.Value
Range("u65000").End(xlUp).Offset(1, 0).Value = TextBox7.Value
Range("v65000").End(xlUp).Offset(1, 0).Value = TextBox8.Value

End If

End Sub

-------------------------------------------------------------------------------
and this i got in my userform_initialize

Private Sub UserForm_Initialize()
Me.TextBox9.Text = Format(Date, "ddd dd mmm yy")


Dim WS As Worksheet
For Each WS In Worksheets
ListBox1.AddItem WS.Name
Next

With Me.ListBox1
.MultiSelect = fmMultiSelectMulti
.ListStyle = fmListStyleOption


End With
End Sub




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default put textbox data in sheet (sheet name selected in a listbox)

hi
if it allowing you to select multiple selections then you have code in the
list box allowing multiple selections. go back to your precious post were you
add some code to mine. remove any multi select options.

regards
FSt1

"pswanie" wrote:

no that does nothing if i use it like that.. i can still select more than one
sheet name

i tried to but it in my commandbutton3_click but get a error

"FSt1" wrote:

hi
try something like this in the list box code.
Private Sub ListBox1_Click()
Worksheets(ListBox1.Text).Activate
End Sub

regards
FSt1

"pswanie" wrote:

yip sorry needs to be column N.

that code worked fine and i got my textboxes 1 to 9 linked.

now. how will i get my code to put the data in the page from the listbox
where i select the page name? how will i get to sellect only one page at a
time in this listbox?

"FSt1" wrote:

hi
not sure. column 9 is column I. do you mean column N??
anyway try this....
change this line....
Range("n9").Value = TextBox7.Value
to...
Range("N65000").end(xlup).offset(1,0).value = textbox7.value
or
Range("N1").end(xldown).offset(1,0).value = textbox1.value

regards
FSt1

"pswanie" wrote:

i got a listbox to list all sheets in workbook.

1) only select one sheettab
2) when user click commandbutton3 put data in the selected sheet
3)not in cell n9 but next open cell in column 9


Private Sub CommandButton3_Click()

myStr = ""

With Me.ListBox1
For iCtr = 0 To .ListCount - 1
If .Selected(iCtr) = True Then
myStr = myStr & ", " & .List(iCtr)
End If
Next
End With

If myStr = "" Then
'nothing checked

MsgBox "Please Select the month this data needs to go to" '& _
''vbNewLine & "If the Name does not appear then add it"
Else
'TextBox7.Value = Format(TextBox7.Value, "##:##")
Range("n9").Value = TextBox7.Value



'myStr = Mid(myStr, Len(mySep) + 1)
End If


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default put textbox data in sheet (sheet name selected in a listbox)


it list all the sheets but i only want one sheet at a time selected and then
the data in textbox1 thru textbox9 needs go in the selected sheet if the
cells next to todays date is empty. (to prevent them from entering data
twice on one day
----------------------------------------------------------------------------------
i changed
-------------------------------------------------------------------------------------
..multiselct - fmmultiselectsingle. now the sheet i pick from the list gets
activated. so thats fixed. no how do i prevent them to run this twice a day?



With Me.ListBox1
.MultiSelect = fmMultiSelectMulti
.ListStyle = fmListStyleOption


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default put textbox data in sheet (sheet name selected in a listbox)

hi
is there a date entered? if not you can put one one the sheet somewhere to
signify that a entry was made that day.
something like this maybe......
if activesheet.range("A1").value = date then
exit sub
end if
probably put somewhere near the start of the code to kill it before it starts.

regards
FSt1

"pswanie" wrote:


it list all the sheets but i only want one sheet at a time selected and then
the data in textbox1 thru textbox9 needs go in the selected sheet if the
cells next to todays date is empty. (to prevent them from entering data
twice on one day)
----------------------------------------------------------------------------------
i changed
-------------------------------------------------------------------------------------
.multiselct - fmmultiselectsingle. now the sheet i pick from the list gets
activated. so thats fixed. no how do i prevent them to run this twice a day?



With Me.ListBox1
.MultiSelect = fmMultiSelectMulti
.ListStyle = fmListStyleOption


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
copying only selected data from Sheet 1 to Sheet 2 Jaf Excel Worksheet Functions 2 September 1st 09 01:01 AM
How can i import data from a cell in another sheet, into a textbox Hans the norwegian Excel Worksheet Functions 1 August 19th 09 01:39 PM
Updating excel sheet with selected data from another sheet in the same file gsnivas Excel Worksheet Functions 1 August 4th 05 09:55 AM
How to copy selected listbox item to sheet michdan Excel Programming 1 July 14th 05 12:49 PM
Data from listbox to Excel sheet James Batley Excel Programming 1 September 24th 04 02:04 PM


All times are GMT +1. The time now is 05:33 AM.

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"