Results 1 to 5 of 5
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    summing in next cicle (2000 sp 1)

    <big>Sal, I have asked this before: do NOT use the Script font for code, it is not easy to read. Use the <!t>
    Code:
    <!/t> ... <!t>
    <!/t> or <!t>[pre]<!/t> ... <!t>[/pre]<!/t> tags instead. HansV
    </big>

    why not work this code... in effect i wat summ the value in coilumn iI and store in a var..

    <pre>Private Sub ComboBox1_Change()

    Dim ws As Worksheet, rng As Range, rngFormData As Range, I As Long

    If ODIC Is Nothing Then
    Set ODIC = CreateObject("Scripting.Dictionary")
    Else
    ODIC.RemoveAll
    End If

    Set ws = Worksheets("H7469_STORICO")
    Set rng = ws.Range(ws.[D2], ws.UsedRange.SpecialCells(xlCellTypeLastCell)).Res ize(ColumnSize:=1)

    rng.AutoFilter Field:=1, Criteria1:=ComboBox1.Value

    Set rngFormData = rng.SpecialCells(xlCellTypeVisible).Cells
    ????????????????????????????
    I = 0

    For Each CEL In rngFormData
    If I > 0 Then
    ODIC.Add I, CEL
    End If
    I = I + 1

    If CEL = ComboBox1.Value Then
    RIGA = CEL.Row
    SOMMA = Range("I" & RIGA)
    TextBox11.Value = SOMMA + SOMMA
    End If
    Next CEL
    ????????????????????????????????????
    ws.UsedRange.AutoFilter

    ScrollBar1.Max = ODIC.Count
    ScrollBar1.Min = 1
    ScrollBar1.SmallChange = 1
    ScrollBar1.LargeChange = ScrollBar1.Max / 4
    ScrollBar1.Value = ScrollBar1.Min

    Set CEL = ODIC(ScrollBar1.Min)

    SetFormValues

    Label50.Caption = ScrollBar1.Value & " / " & ScrollBar1.Max

    End Sub</pre>


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: summing in next cicle (2000 sp 1)

    I don't understand what you want to do. Please explain more clearly.

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: summing in next cicle (2000 sp 1)

    Sorry for tag script...
    In column I are value of ammount

    During the cicle i want to summ each cell with the value in cbox1 and store the gran total in textbox11...

    I have solved with range , but i think not is progfesional, or not?


    I = 0

    For Each CEL In rngFormData
    If I > 0 Then
    ODIC.Add I, CEL
    End If
    I = I + 1
    If CEL = ComboBox1.Value Then
    RIGA = CEL.Row
    SOMMA = Range("I" & RIGA)
    Range("E1").Value = Range("E1").Value + SOMMA
    TextBox11.Value = Range("E1").Value
    End If
    Next CEL

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: summing in next cicle (2000 sp 1)

    Instead of

    SOMMA = Range("I" & RIGA)
    Range("E1").Value = Range("E1").Value + SOMMA

    you can use

    SOMMA = Range("I" & RIGA) + SOMMA

    If think you should set TextBox11 after the loop has finished (below the line Next CEL)

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: summing in next cicle (2000 sp 1)

    tks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •