Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default How to code, AND where to place it !!

I want to enable once the Combobox is left, that the value that was chosen from the worksheet, to change to a strikethrough font.

I am not sure how to code this, AND if it should go in the combobox section below or in the Commandbutton (OK) click on the userform,
What would i code and where to put it?

Private Sub ComboBox6_Exit(ByVal Cancel As MSForms.ReturnBoolean)

End Sub

OR

Private Sub CommandButton1_Click()
Sheets("DespatchData").Select
' does the stuff here
Unload Me
Sheets("Main").Select
Range("A1").Activate
End Sub




Code i use to populate Combobox6:

Private Sub ComboBox6_DropButtonClick()
Application.ScreenUpdating = False
If ComboBox6.ListCount 0 Then Exit Sub
'Place the References in here for the Roll Numbers and Lengths
Dim lastcell As Long
Dim myrow As Long

lastcell = workSheets("InspectionData").Cells(Rows.Count, "A").End(xlUp).Row

With ActiveWorkbook.workSheets("InspectionData")
For myrow = 2 To lastcell
If .Cells(myrow, 1) < "" Then
If .Cells(myrow, 1).Offset(-1, 2).Text = ComboBox28.Text And .Cells(myrow, 1).Offset(-1, 6).Text = ComboBox1.Text And .Cells(myrow, 1).Offset(0, 0).Value = ComboBox5.Text And IsNumeric(Trim(Mid(.Cells(myrow, 1), 2))) = True Then
For i = 2 To 22
If Cells(myrow, 3).Offset(i, 0).Font.Strikethrough = False And Cells(myrow, 3).Offset(i, 0).Value < "" Then
ComboBox6.AddItem Cells(myrow, 3).Offset(i, 0)
Cells(myrow, 3).Offset(i, 0).Font.Strikethrough = True
End If
Next i
End If
End If
Next
End With

Application.ScreenUpdating = True
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default How to code, AND where to place it !!

"I want to enable once the Combobox is left, that the value that was
chosen from the worksheet, to change to a strikethrough font."

Huh?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default How to code, AND where to place it !!

Meaning Once the selection has been done,
and the user moves on to the next item,
the value(NOT in the combobox it self)
but the value that populated the combobox
(eg. Say combobox list was sheet4 C2:C26. and C25 was selected then
....Sheet4 C25) has the value changed to Strikethrough.

I added this but it changed ALL(i, 2) values to strikethrough:


Private Sub ComboBox6_DropButtonClick()
Application.ScreenUpdating = False
If ComboBox6.ListCount 0 Then Exit Sub
'Place the References in here for the Roll Numbers and Lengths
Dim lastcell As Long
Dim myrow As Long

lastcell = workSheets("InspectionData").Cells(Rows.Count,
"A").End(xlUp).Row

With ActiveWorkbook.workSheets("InspectionData")
For myrow = 2 To lastcell
If .Cells(myrow, 1) < "" Then
If .Cells(myrow, 1).Offset(-1, 2).Text = ComboBox28.Text And
..Cells(myrow, 1).Offset(-1, 6).Text = ComboBox1.Text And .Cells(myrow,
1).Offset(0, 0).Value = ComboBox5.Text And IsNumeric(Trim(Mid(.Cells(myrow,
1), 2))) = True Then
For i = 2 To 22
If Cells(myrow, 3).Offset(i, 0).Font.Strikethrough =
False And Cells(myrow, 3).Offset(i, 0).Value < "" Then
ComboBox6.AddItem Cells(myrow, 3).Offset(i, 0)
Cells(myrow, 3).Offset(i,
0).Font.Strikethrough = True ' <================= Here. But ALL values
changed. But i need to give user option to replace the value if wrongly
selected. That is why i was thinking of Combobox6 Exit section????
End If
Next i
End If
End If
Next
End With

Application.ScreenUpdating = True
End Sub


Hope i cleared that up a bit.

Corey....






"Jim Cone" wrote in message
...
"I want to enable once the Combobox is left, that the value that was
chosen from the worksheet, to change to a strikethrough font."

Huh?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default How to code, AND where to place it !!

You are using the DropButtonClick event.
The user does not select an item when the dropdown is clicked.
Selection is done in the ComboBox_Click event.

You can get the index of the item selected and use that to
find the worksheet cell or run a Match function on the value...

Private Sub ComboBox1_Click()
MsgBox ComboBox1.Value & vbCr & ComboBox1.ListIndex
End Sub
--
It is time for bed.
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Corey"
wrote in message
Meaning Once the selection has been done,
and the user moves on to the next item,
the value(NOT in the combobox it self)
but the value that populated the combobox
(eg. Say combobox list was sheet4 C2:C26. and C25 was selected then
....Sheet4 C25) has the value changed to Strikethrough.

I added this but it changed ALL(i, 2) values to strikethrough:


Private Sub ComboBox6_DropButtonClick()
Application.ScreenUpdating = False
If ComboBox6.ListCount 0 Then Exit Sub
'Place the References in here for the Roll Numbers and Lengths
Dim lastcell As Long
Dim myrow As Long

lastcell = workSheets("InspectionData").Cells(Rows.Count,
"A").End(xlUp).Row

With ActiveWorkbook.workSheets("InspectionData")
For myrow = 2 To lastcell
If .Cells(myrow, 1) < "" Then
If .Cells(myrow, 1).Offset(-1, 2).Text = ComboBox28.Text And
..Cells(myrow, 1).Offset(-1, 6).Text = ComboBox1.Text And .Cells(myrow,
1).Offset(0, 0).Value = ComboBox5.Text And IsNumeric(Trim(Mid(.Cells(myrow,
1), 2))) = True Then
For i = 2 To 22
If Cells(myrow, 3).Offset(i, 0).Font.Strikethrough =
False And Cells(myrow, 3).Offset(i, 0).Value < "" Then
ComboBox6.AddItem Cells(myrow, 3).Offset(i, 0)
Cells(myrow, 3).Offset(i,
0).Font.Strikethrough = True ' <================= Here. But ALL values
changed. But i need to give user option to replace the value if wrongly
selected. That is why i was thinking of Combobox6 Exit section????
End If
Next i
End If
End If
Next
End With

Application.ScreenUpdating = True
End Sub


Hope i cleared that up a bit.

Corey....






"Jim Cone" wrote in message
...
"I want to enable once the Combobox is left, that the value that was
chosen from the worksheet, to change to a strikethrough font."

Huh?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default How to code, AND where to place it !!

When i cut/paste the code to the click section instead of the
dropbuttonclick i get NO list then ??


"Jim Cone" wrote in message
...
You are using the DropButtonClick event.
The user does not select an item when the dropdown is clicked.
Selection is done in the ComboBox_Click event.

You can get the index of the item selected and use that to
find the worksheet cell or run a Match function on the value...

Private Sub ComboBox1_Click()
MsgBox ComboBox1.Value & vbCr & ComboBox1.ListIndex
End Sub
--
It is time for bed.
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Corey"
wrote in message
Meaning Once the selection has been done,
and the user moves on to the next item,
the value(NOT in the combobox it self)
but the value that populated the combobox
(eg. Say combobox list was sheet4 C2:C26. and C25 was selected then
...Sheet4 C25) has the value changed to Strikethrough.

I added this but it changed ALL(i, 2) values to strikethrough:


Private Sub ComboBox6_DropButtonClick()
Application.ScreenUpdating = False
If ComboBox6.ListCount 0 Then Exit Sub
'Place the References in here for the Roll Numbers and Lengths
Dim lastcell As Long
Dim myrow As Long

lastcell = workSheets("InspectionData").Cells(Rows.Count,
"A").End(xlUp).Row

With ActiveWorkbook.workSheets("InspectionData")
For myrow = 2 To lastcell
If .Cells(myrow, 1) < "" Then
If .Cells(myrow, 1).Offset(-1, 2).Text = ComboBox28.Text
And
.Cells(myrow, 1).Offset(-1, 6).Text = ComboBox1.Text And .Cells(myrow,
1).Offset(0, 0).Value = ComboBox5.Text And
IsNumeric(Trim(Mid(.Cells(myrow,
1), 2))) = True Then
For i = 2 To 22
If Cells(myrow, 3).Offset(i, 0).Font.Strikethrough
=
False And Cells(myrow, 3).Offset(i, 0).Value < "" Then
ComboBox6.AddItem Cells(myrow, 3).Offset(i, 0)
Cells(myrow, 3).Offset(i,
0).Font.Strikethrough = True ' <================= Here. But ALL values
changed. But i need to give user option to replace the value if wrongly
selected. That is why i was thinking of Combobox6 Exit section????
End If
Next i
End If
End If
Next
End With

Application.ScreenUpdating = True
End Sub


Hope i cleared that up a bit.

Corey....






"Jim Cone" wrote in message
...
"I want to enable once the Combobox is left, that the value that was
chosen from the worksheet, to change to a strikethrough font."

Huh?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default How to code, AND where to place it !!

Is there not a code like:
if Combobox6.SelectionSource <"" then
Combobox6.SelectionSource.Font.Strikethrough=TRUE


Corey....
"Corey" wrote in message
...
When i cut/paste the code to the click section instead of the
dropbuttonclick i get NO list then ??


"Jim Cone" wrote in message
...
You are using the DropButtonClick event.
The user does not select an item when the dropdown is clicked.
Selection is done in the ComboBox_Click event.

You can get the index of the item selected and use that to
find the worksheet cell or run a Match function on the value...

Private Sub ComboBox1_Click()
MsgBox ComboBox1.Value & vbCr & ComboBox1.ListIndex
End Sub
--
It is time for bed.
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Corey"
wrote in message
Meaning Once the selection has been done,
and the user moves on to the next item,
the value(NOT in the combobox it self)
but the value that populated the combobox
(eg. Say combobox list was sheet4 C2:C26. and C25 was selected then
...Sheet4 C25) has the value changed to Strikethrough.

I added this but it changed ALL(i, 2) values to strikethrough:


Private Sub ComboBox6_DropButtonClick()
Application.ScreenUpdating = False
If ComboBox6.ListCount 0 Then Exit Sub
'Place the References in here for the Roll Numbers and Lengths
Dim lastcell As Long
Dim myrow As Long

lastcell = workSheets("InspectionData").Cells(Rows.Count,
"A").End(xlUp).Row

With ActiveWorkbook.workSheets("InspectionData")
For myrow = 2 To lastcell
If .Cells(myrow, 1) < "" Then
If .Cells(myrow, 1).Offset(-1, 2).Text = ComboBox28.Text
And
.Cells(myrow, 1).Offset(-1, 6).Text = ComboBox1.Text And .Cells(myrow,
1).Offset(0, 0).Value = ComboBox5.Text And
IsNumeric(Trim(Mid(.Cells(myrow,
1), 2))) = True Then
For i = 2 To 22
If Cells(myrow, 3).Offset(i, 0).Font.Strikethrough
=
False And Cells(myrow, 3).Offset(i, 0).Value < "" Then
ComboBox6.AddItem Cells(myrow, 3).Offset(i, 0)
Cells(myrow, 3).Offset(i,
0).Font.Strikethrough = True ' <================= Here. But ALL values
changed. But i need to give user option to replace the value if wrongly
selected. That is why i was thinking of Combobox6 Exit section????
End If
Next i
End If
End If
Next
End With

Application.ScreenUpdating = True
End Sub


Hope i cleared that up a bit.

Corey....






"Jim Cone" wrote in message
...
"I want to enable once the Combobox is left, that the value that
was
chosen from the worksheet, to change to a strikethrough font."

Huh?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default How to code, AND where to place it !!

Add the list in the DropButtonClick event.
Do the cell strikethrough using the ComboBox_Click event.
--
Jim Cone
San Francisco
http://www.officeletter.com/blink/specialsort.html


"Corey"
wrote in message
Is there not a code like:
if Combobox6.SelectionSource <"" then
Combobox6.SelectionSource.Font.Strikethrough=TRUE


Corey....
"Corey" wrote in message
...
When i cut/paste the code to the click section instead of the
dropbuttonclick i get NO list then ??


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
Code to place value in another cell chris46521[_6_] Excel Programming 4 July 26th 06 07:30 PM
template code in one place bill Excel Programming 3 May 18th 06 03:50 PM
where do i place the code ? Asha Excel Programming 2 October 18th 05 04:13 PM
Wherre best to place code luke New Users to Excel 2 August 22nd 05 08:25 PM
Where to place Code question Stuart[_21_] Excel Programming 9 April 28th 05 08:06 PM


All times are GMT +1. The time now is 01:31 AM.

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

About Us

"It's about Microsoft Excel"