+ Reply to Thread
Results 1 to 2 of 2

Problems with filtering and output

  1. #1
    Registered User
    Join Date
    07-27-2006
    Posts
    23

    Problems with filtering and output

    Hi Guys,

    I've got 2 problems with my vba code.

    Description of my spreadsheet : The spreadsheet has 2 worksheets. Worksheet A has 4 columns (descr, cl, il, and a1). All the columns except for the descr column contain crosses (x). Worksheet B is a worksheet where I have to post results (it's an output page).

    Problems :
    1. I've got to filter the descriptions (column descr) based on the crosses in the columns cl, il and a1. However, filtering should be based on the following rules :
    Descr A : cl x, il, a1 x --> output because there is a cross in column cl
    Descr B : cl, il, a1 --> not sent to output because there are no crosses
    Descr C : cl, il x, a1 x --> output because there is a cross in columns il and a1

    2. I want to put the output from problem 1 in a single field in worksheet B. The output will contain a list of descriptions.

    Can someone help me to build this VBA code please ?

    Floep

  2. #2
    Tom Ogilvy
    Guest

    RE: Problems with filtering and output

    Sub ABC()
    Dim cell as Range, rng as Range
    Dim s as String
    with worksheets("worksheet A")
    set rng = .Range(.Cells(2,1),.Cells(rows.count,1).End(xlup))
    End with
    for each cell in rng
    if cell.offset(0,1).Value = "x" or _
    cell.offset(0,2).Value = "x" and _
    cell.offset(0,3).Value = "x" then
    s = s & cell.value & vbNewLine
    end if
    Next
    Worksheets("Worksheet B").Range("B9").Value = s
    End Sub

    --
    Regards,
    Tom Ogilvy


    "floep" wrote:

    >
    > Hi Guys,
    >
    > I've got 2 problems with my vba code.
    >
    > Description of my spreadsheet : The spreadsheet has 2 worksheets.
    > Worksheet A has 4 columns (descr, cl, il, and a1). All the columns
    > except for the descr column contain crosses (x). Worksheet B is a
    > worksheet where I have to post results (it's an output page).
    >
    > Problems :
    > 1. I've got to filter the descriptions (column descr) based on the
    > crosses in the columns cl, il and a1. However, filtering should be
    > based on the following rules :
    > Descr A : cl x, il, a1 x --> output because there is a cross in column
    > cl
    > Descr B : cl, il, a1 --> not sent to output because there are no
    > crosses
    > Descr C : cl, il x, a1 x --> output because there is a cross in columns
    > il and a1
    >
    > 2. I want to put the output from problem 1 in a single field in
    > worksheet B. The output will contain a list of descriptions.
    >
    > Can someone help me to build this VBA code please ?
    >
    > Floep
    >
    >
    > --
    > floep
    > ------------------------------------------------------------------------
    > floep's Profile: http://www.excelforum.com/member.php...o&userid=36853
    > View this thread: http://www.excelforum.com/showthread...hreadid=565583
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1