in Education by
I'm using VB code created by L42 on 4/27/14 that creates a checkbox list in a single cell. Option Explicit Dim fillRng As Range Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim LBColors As MSForms.ListBox Dim LBobj As OLEObject Dim i As Long Set LBobj=Me.OLEObjects("LB_Colors") Set LBColors = Target If Not Intersect(Target, [B2]) Is Nothing Then Set fillRng = Target With LBobj .Left = fillRng.Left .Top = fillRng.Top .Width = fillRng.Width .Visible = True End With Else LBobj.Visible = False If Not fillRng Is Nothing Then fillRng.ClearContents With LBColors If .ListCount <> 0 Then For i = 0 To .ListCount -1 If fillRng.Value = Then If .Selected(i) Then fillRng.Value = .List(i) Else If .Selected(i) Then fillRng.Value = _ fillRng.Value & "," & .List(i) End If Next End With Set fillRng = Nothing End If End If End Sub The code works perfectly and I was able to extend the checkbox list to the cells in complete column by changing the (Target, [B1:B40]). Following this logic, I thought that I could extend checkboxes C and D columns by (Target, [B1:D40]. However, after selecting desired items in B column and clicking or tabing over to C column, the entire checkbox moves with selected items without writing in the previous cell. I would like to be able to tab over or click to the next cell in the row and have same checkbox items that populates that cell with item selected, independent of the previous cell. Then tab or click to succeeding cells and do the same and have cells retain and display selected the items. Can this code be modified to do that? Thank you. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
to always put the values in the cell, just change your code to something like this: Option Explicit Dim fillRng As Range Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim LBColors As MSForms.ListBox Dim LBobj As OLEObject Dim i As Long Set LBobj = Me.OLEObjects("LB_Colors") Set LBColors = Target LBobj.Visible = False If Not fillRng Is Nothing Then fillRng.ClearContents With LBColors If .ListCount <> 0 Then For i = 0 To .ListCount - 1 If .Selected(i) Then If fillRng.Value = "" Then fillRng.Value = .List(i) Else fillRng.Value = fillRng.Value & "," & .List(i) End If End If Next End If End With Set fillRng = Nothing End If If Not Intersect(Target, [B1:D40]) Is Nothing Then Set fillRng = Target With LBobj .Left = fillRng.Left .Top = fillRng.Top .Width = fillRng.Width .Visible = True End With End If End Sub

Related questions

0 votes
    EDIT : This issue also concerns Material Ui's Data table. I tried using the same example as given by the documentation ... of these script tags are needed for the old legacy app)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I'm trying to create a little popup-menu that displays a series of checkboxes to the user in Java ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    what happens to cell content when multi cells are marged to from a single cell? Select the correct answer from above options...
asked Dec 5, 2021 in Education by JackTerrance
0 votes
    what happens to cell content when multi cells are marged to from a single cell? Select the correct answer from above options...
asked Nov 26, 2021 in Education by JackTerrance
0 votes
    I have encountered a problem during my work. There are over one hundred worksheets in my excel, and I ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    This question is corresponding to this link VBA Excel : Extract data in specific format from CSV files but ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    How to read an excel sheet and put the cell value within different text fields through UiPath? I have a excel ... help me out please? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I have an excel workbook that has more than 20 pages, each has a plenty amount of data. Every ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 15, 2022 in Education by JackTerrance
0 votes
    c. To copy a formula in Microsoft Excel, you select the cell and drag this symbol that appears on the lower ... 7 computer please help Select the correct answer from above options...
asked Dec 28, 2021 in Education by JackTerrance
0 votes
    To copy a formula in Microsoft Excel, you select the cell and drag this ___ write one word Select the correct answer from above options...
asked Dec 27, 2021 in Education by JackTerrance
0 votes
    To copy a formula in Microsoft Excel, you select the cell and drag this ___ write one word Select the correct answer from above options...
asked Dec 26, 2021 in Education by JackTerrance
0 votes
    which excel function is used to combine conrents from different cells into one cell? 1. concatenate() 2. consol() 3. void() 4.main() Select the correct answer from above options...
asked Dec 14, 2021 in Education by JackTerrance
0 votes
    a. b. Any formula in Excel starts saluctangulshows the formula used in the selected cell. A formula which is ... forma C. onerator Select the correct answer from above options...
asked Dec 14, 2021 in Education by JackTerrance
0 votes
    How to specify cell range from A10 to A 25 in MS Excel? (a) (A10-A25) (b) (A10 to A25) (c) (A10 : A25) (d) (A10 . A25) (e) (A10 A25) Select the correct answer from above options...
asked Dec 12, 2021 in Education by JackTerrance
...