Consulting

Results 1 to 3 of 3

Thread: Solved: how to find the value with 2 conditions

  1. #1
    VBAX Regular
    Joined
    Jan 2009
    Posts
    93
    Location

    Solved: how to find the value with 2 conditions

    dear everybody,

    now me is solving problem how to find the value with 2 conditions?

    no idea for now, if somebody knows the way forward,

    please help me, happy and sunny day, Pavel

    Weight upto (1st condition)
    Distance upto (2nd condition)
    Price = ?

    example file appended

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    It would help to rearrange the table, see attached
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Regular
    Joined
    Jan 2009
    Posts
    93
    Location

    Dear p45cal, THANK You a lot, You are genius.

    Dear p45cal, my table was originally arranged this way.

    THANK You a lot, You are genius me was not able
    to solve it.

    p45cal me is wishing you good luck and sunny day,
    Pavel Humenuk

    originally me used this link:
    http://www.ozgrid.com/forum/showthread.php?t=45511
    to rearrange it.

    [vba]
    Sub CreateFlat()
    Dim wsData As Worksheet
    Dim wsNew As Worksheet
    Dim rngSrc As Range
    Dim rngDst As Range
    Dim LastCol As Long
    Dim LastRow As Long
    Dim LastRowDst As Long
    Dim I As Long

    Set wsData = Worksheets("Sheet1")
    Set wsNew = Worksheets.Add

    LastRow = wsData.Range("A" & Rows.Count).End(xlUp).Row
    LastRowDst = 2
    LastCol = wsData.Range("IV1").End(xlToLeft).Column

    wsNew.Range("A1:C1") = Array("Resources", "Month", "Value")
    For I = 2 To LastRow
    Set rngSrc = wsData.Range("A" & I)
    Set rngDst = wsNew.Range("A" & LastRowDst)

    rngSrc.Copy rngDst.Resize(LastCol - 1)

    rngSrc.Offset(-(I - 1), 1).Resize(, LastCol - 1).Copy
    rngDst.Offset(0, 1).PasteSpecial Transpose:=True
    rngSrc.Offset(, 1).Resize(, LastCol - 1).Copy
    rngDst.Offset(0, 2).PasteSpecial Transpose:=True
    LastRowDst = LastRowDst + (LastCol - 1)
    Next I
    End Sub
    [/vba]

Posting Permissions

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