logo
down
shadow

Using drop-down list to change multiple values in separate table cells


Using drop-down list to change multiple values in separate table cells

Content Index :

Using drop-down list to change multiple values in separate table cells
Tag : javascript , By : Mark
Date : January 11 2021, 03:32 PM

I wish did fix the issue. At the end of your html code, before closing the <\body> tag, insert this
<script>
document.getElementById('columns').addEventListener("change", function(){
  switch(this.value){
    case 'Result A':
      document.getElementById('row1').innerHTML='A';
      document.getElementById('row2').innerHTML='B';
      document.getElementById('row3').innerHTML='C';
      break;
    case 'Result B':
      document.getElementById('row1').innerHTML='D';
      document.getElementById('row2').innerHTML='E';
      document.getElementById('row3').innerHTML='F';
      break;
    case 'Result C':
      document.getElementById('row1').innerHTML='G';
      document.getElementById('row2').innerHTML='H';
      document.getElementById('row3').innerHTML='I';
      break;
  }
})
</script>

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Drag and Drop list items between table cells - jQuery


Tag : jquery , By : Ari
Date : March 29 2020, 07:55 AM
Any of those help I think next solution is simple and useful for your: http://jqueryui.com/demos/sortable/#connect-lists

Change drop down list values when another user makes a choice from another drop down list in the same form


Tag : php , By : Simon Capewell
Date : March 29 2020, 07:55 AM
seems to work fine I would do this in one of the following ways, both involve javascript:
1. When the first select box value changes, load the second select box with AJAX (remove the current second select box).

How to split cells containing multiple values (comma delimited) into separate rows?


Tag : excel , By : hsdfhksh
Date : March 29 2020, 07:55 AM
this will help You should not only iterate the rows, but also the columns, and check in each cell whether there is such a comma. When at least one of the cells in a row has a comma, it should be split.
You could then insert the row, and copy the parts before the comma in the newly created row, while removing that part from the original row which is then moved up one index.
Sub Splt()
    Dim LR As Long, LC As Long, r As Long, c As Long, pos As Long
    Dim v As Variant

    Application.ScreenUpdating = False
    LR = Cells(Rows.Count, 1).End(xlUp).Row
    LC = Cells(1, Columns.Count).End(xlToLeft).Column
    r = 2
    Do While r <= LR
        For c = 1 To LC
            v = Cells(r, c).Value
            If InStr(v, ",") Then Exit For ' we need to split
        Next
        If c <= LC Then ' We need to split
            Rows(r).EntireRow.Insert
            LR = LR + 1
            For c = 1 To LC
                v = Cells(r + 1, c).Value
                pos = InStr(v, ",")
                If pos Then
                    Cells(r, c).Value = Left(v, pos - 1)
                    Cells(r + 1, c).Value = Trim(Mid(v, pos + 1))
                Else
                    Cells(r, c).Value = v
                End If
            Next
        End If
        r = r + 1
    Loop
    Application.ScreenUpdating = True
End Sub

Excel: [pics added] Change cells with specific values based on drop down list


Tag : excel , By : user181345
Date : March 29 2020, 07:55 AM
will help you Yes, its doable.
So you will have 8 combinations you will have to add manually in the Conditional Formatting. Select Cell C3:C7 (which range the conditional formula should be applied to) and the go to "Conditional Formatting" -> "Use a formula to determine which cells to format".
=IF(C3="teamA";$H$3="win")
=IF(C3="teamA";$H$3="win") --- Applies to range: =$C$3:$C$7 (is showed above as an example)
=IF(C3="teamA";$H$3="lost") --- Applies to range: =$C$3:$C$7

=IF(C3="teamB";$H$4="win") --- Applies to range: =$C$3:$C$7
=IF(C3="teamB";$H$4="lost") --- Applies to range: =$C$3:$C$7

=IF(D3="teamC";$H$6="win") --- Applies to range: =$D$3:$D$7
=IF(D3="teamC";$H$6="lost") --- Applies to range: =$D$3:$D$7

=IF(D3="teamD";$H$7="win") --- Applies to range: =$D$3:$D$7
=IF(D3="teamD";$H$7="lost") --- Applies to range: =$D$3:$D$7
Nordic: ";"  - =IF(C3="teamA";$H$3="win")
US: ","      - =IF(C3="teamA",$H$3="win")

How to separate a column of cells with multiple values (delimited) into new columns and add a header


Tag : excel , By : MikeG
Date : March 29 2020, 07:55 AM
I wish this help you Maybe you could try the following code, using dictionaries. It's rather messy, and it could probably be done in simpler way, but it seems to work. Just edit the datarange line.
Option Explicit
Sub DataRange()
    Dim DataRange As Range
    Dim DataSheet As Worksheet
    Dim c As Range
    Dim DataString As String
    Dim DataDictionary As Object 'SCRIPTING.DICTIONARY
    Dim TargetColumns As Object 'SCRIPTING.DICTIONARY
    Dim TargetColumn As Long
    Dim Key As String
    Dim TargetAddress As String

    Dim xlCurrentCalculation As XlCalculation
    Dim i As Long
    TargetColumn = 2

    xlCurrentCalculation = Application.Calculation
    Application.Calculation = xlCalculationManual
'#############################################################################################
    Set DataRange = ActiveSheet.Range("A2:A21") 'EDIT THIS LINE WITH ACTUAL DATA ADDRESS
'#############################################################################################
    Set DataSheet = DataRange.Parent
    Set TargetColumns = CreateObject("SCRIPTING.DICTIONARY")
    For Each c In DataRange
        DataString = CStr(c)
        Set DataDictionary = DataStringToDataDictionary(DataString)
        For i = 0 To DataDictionary.Count - 1
            Key = DataDictionary.keys()(i)
            If Not TargetColumns.exists(Key) Then
                TargetColumns.Add Key, TargetColumn
                TargetColumn = TargetColumn + 1
            End If
            TargetAddress = TargetColumns(Key) & c.Row
            DataSheet.Cells(c.Row, TargetColumns.Item(Key)) = DataDictionary.items()(i)
        Next i
    Next c
    For i = 0 To TargetColumns.Count - 1
        DataSheet.Cells(1, TargetColumns.items()(i)) = TargetColumns.keys()(i)
    Next i

    'Uncomment the following line to delete the column of the data containing the range.
    'It will create an offset in written data though
    'DataRange.EntireColumn.Delete
    Application.Calculate
    Application.Calculation = xlCalculationAutomatic
End Sub
Function DataStringToDataDictionary(DataString As String)

    Dim DataArray() As String
    Dim DataSubArray() As String
    Dim DataDictionary As Object 'SCRIPTING.DICTIONARY
    Dim Key As String
    Dim Value As String
    Dim i As Long

    DataArray = Split(DataString, ";")
    'We ignore first element of the array, as we assume it contains the word "Data"

    Set DataDictionary = CreateObject("SCRIPTING.DICTIONARY")
    For i = 1 To UBound(DataArray)
        DataSubArray = Split(DataArray(i), "=")
        Key = DataSubArray(0)
        Value = DataSubArray(1)
        DataDictionary.Add Key, Value
    Next i

    Set DataStringToDataDictionary = DataDictionary

End Function
If the previous code does not work, you could also try the following :


Sub SplittingDataWithoutDictionary()
    Dim DataRange As Range
    Dim DataSheet As Worksheet
    Dim c As Range
    Dim DataArray() As String
    Dim DataSubArray() As String
    Dim HeadersLabels() As Variant
    Dim i As Long
    Dim FirstWriteBackColumn As Long
    Dim Index As Long
    Dim Value As String

    Dim xlCurrentCalculation As XlCalculation

    xlCurrentCalculation = Application.Calculation
    Application.Calculation = xlCalculationManual


    HeadersLabels = Array("X", "Y", "Z", "V", "G")

    Set DataRange = ActiveSheet.Range("A2:A20") 'Edit with the actual range you want to split
    Set DataSheet = DataRange.Worksheet
    FirstWriteBackColumn = 2 'Edit with the first column in which you want to write back data

    For Each c In DataRange
        DataArray = Split(CStr(c), ";")
        For i = 1 To UBound(DataArray)
            DataSubArray = Split(DataArray(i), "=")
            Index = FetchIndexInArray(HeadersLabels, DataSubArray(0))
            Value = DataSubArray(1)
            DataSheet.Cells(c.Row, FirstWriteBackColumn + Index) = Value
        Next i
    Next c
    For i = 0 To UBound(HeadersLabels)
        DataSheet.Cells(1, i + FirstWriteBackColumn) = HeadersLabels(i)
    Next i
    'Datarange.entirecolumn.delete
    Application.Calculation = xlCurrentCalculation
End Sub

Function FetchIndexInArray(StringArray() As Variant, LookFor As String) As Long
    Dim i As Long

    For i = LBound(StringArray) To UBound(StringArray)
        If StringArray(i) = LookFor Then
            FetchIndexInArray = i
            Exit Function
        End If
    Next i
End Function
Related Posts Related QUESTIONS :
  • How to convert javascript code for Angular
  • XPath select on child nodes
  • Idle event on mouse move - how to stop script permanently on mouse move
  • Why do I get logic is not defined in this code
  • When I enter a number in the input, the first function starts
  • ES6 imports and node_modules hell
  • How to get css selector of clicked-on element?
  • How to auto input MySQL data (input column 1 data to auto input column 2 data with same column) in php?
  • Appending to Datalist Via Javascript
  • Customizing Material-UI Components with Styled-Components
  • Populate elements with class name using Javascript
  • How to execute promises in batches (first resolving 10, then next 10 and so on)
  • Maximo JS automation script: "importPackage" is not defined
  • How to surround selected text inside textarea with <em> on key combination CTRL+i?
  • Your configured registry does not support audit requests ~ On npm audit
  • What's the Angular equivalent of Vue <slot/>?
  • Iconify icon not updating when "data-icon" set with setAttribute()
  • Javascript newbie stuck with XMLHttpRequest return data
  • How to add obj to to state in my example Redux React
  • Loading "grunt-karma.js" tasks...ERROR >> SyntaxError: Unexpected identifier
  • Why do I get log is not defined
  • get the multiple index of the same string
  • How can I iterate over an Array object by using For IN or FOR OF
  • Launch local executable from web browser
  • How to prepare array of json objects to d3 hierarchical tree structure
  • VueJS - event emitted - show HTML before other calculations
  • Export SASS/SCSS variables to Javascript without exporting them to CSS
  • How to attach an event handler only once continuously
  • How to make button open a link in new tab in JavaScript?
  • Find range from the javascript object
  • How can I use my jQuery code as JavaScript?
  • How to show 5 images in a 2 row slider with bxslider
  • How to convert stream into variables in typescript
  • Three.js custom shader error on Chrome GL_INVALID_OPERATION: Active draw buffers with missing fragment shader outputs
  • My JavaScript doesn't work. How can I solve this problem?
  • Why is this async function is running synchronously?
  • Get updated variable from within react hook before return
  • I want to show all image preview but whenever I upload a new one the old one is gone
  • Would I be able to give access to specific electron APIs safely?
  • Why several clicks fire for each instance of a Class?
  • cant grab value from div using attr()
  • Make web service not accessible by browser?
  • Select DOM elements within template
  • How to customize angular ui-grid row background color?
  • Binding data in two respective $scope in AngularJS, how?
  • react put some props after import class
  • Variable is distributed among same components
  • switch class in jQuery/JavaScript for active/inactive state
  • How To Track Outbound Clicks Using Javascript
  • How to get total seconds elapsed since the beginning of the month?
  • Protractor: Stale element reference at "browser.wait(EC.visibilityOf(confDial), FIFTY_SECONDS);"
  • Access to an array inside an object
  • Reseting an JavaScript Interval with different value?
  • Learning Angular for the first time - version 2 or 4?
  • Rendering RSS feed (XML) in React with jquery, why do object values parsed from the feed seem empty?
  • Node.js xml2js http.request tag matching
  • applying texture to custom plane geometry in Threejs
  • How do I pass an Event as a function parameter in HTML written inside JavaScript variable?
  • Interface of object parameter with default value and default property
  • Does using try / catch rather than `.catch` observable operator with XHR requests reduce performance?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com