ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Listbox to change value in cell (https://www.excelbanter.com/excel-programming/435295-listbox-change-value-cell.html)

Jeremy

Listbox to change value in cell
 
I have a listbox with 3 columns going (1, 2, 3). Feeding this listbox is a
sheet with three columns (A,B,C).

What I am trying to do is when the user clicks on a button, the value that
is currently selected in listbox column 3 is looked up on the sheet in Column
C and the value next to it, Column B is changed to "yes"...which would then
change the listbox column 2 to "yes"

I know I need to do an offset, but having a hard time getting started, I
appreciate anyone's help.

Patrick Molloy[_2_]

Listbox to change value in cell
 
try this

Private Sub CommandButton1_Click()

If ListBox1.ListIndex < 0 Then Exit Sub

With Worksheets("Sheet2").Range("A6")
.Offset(ListBox1.ListIndex, 1) = "yes"
End With

End Sub


"Jeremy" wrote:

I have a listbox with 3 columns going (1, 2, 3). Feeding this listbox is a
sheet with three columns (A,B,C).

What I am trying to do is when the user clicks on a button, the value that
is currently selected in listbox column 3 is looked up on the sheet in Column
C and the value next to it, Column B is changed to "yes"...which would then
change the listbox column 2 to "yes"

I know I need to do an offset, but having a hard time getting started, I
appreciate anyone's help.



All times are GMT +1. The time now is 01:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com