PDA

View Full Version : Solved: If command



khalid79m
02-27-2009, 06:22 AM
Sheets("O_BCDU").Range("I:I").AutoFilter Field:=1, Criteria1:="Man2"
Sheets("O_BCDU").Range("O_BCDU20_CR_Cay_1").SpecialCells(xlCellTypeVisible).Value = "H"

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

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

can anyone help?

Tom527
02-27-2009, 06:46 AM
you can try:



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

khalid79m
03-02-2009, 03:20 AM
thanksmate