Consulting

Results 1 to 3 of 3

Thread: Solved: If command

  1. #1

    Solved: If command

    [vba] Sheets("O_BCDU").Range("I:I").AutoFilter Field:=1, Criteria1:="Man2"
    Sheets("O_BCDU").Range("O_BCDU20_CR_Cay_1").SpecialCells(xlCellTypeVisible) .Value = "H"[/vba]

    this code FILTERS on range I:I for Man2 then deletes all special cells.

    i only want it to do this if Range("O_BCDU20_CR_Cay_1") contains "Man2"
    if it does then

    [vba] Sheets("O_BCDU").Range("I:I").AutoFilter Field:=1, Criteria1:="Man2"
    Sheets("O_BCDU").Range("O_BCDU20_CR_Cay_1").SpecialCells(xlCellTypeVisible) .Value = "H"[/vba]

    can anyone help?

  2. #2
    you can try:


    [vba]
    if instr(1,Range("O_BCDU20_CR_Cay_1") ,"Man2",vbTextCompare) > 0 then
    Sheets("O_BCDU").Range("I:I").AutoFilter Field:=1, Criteria1:="Man2"
    Sheets("O_BCDU").Range("O_BCDU20_CR_Cay_1").SpecialCells(xlCellTypeVisible) .Value = "H"
    end if
    [/vba]

  3. #3
    thanksmate

Posting Permissions

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