I
Ivan
Hi,
sheet1 data
2 a
5 b
12 c
sheet2 data
2
3
4
I would like to write a macro as follows:
if I find the value in column a of sheet 1 IN column a in sheet 2, hide that
column in sheet one (loop for the range of cells).
I have the following so far: I am clearly having trouble figuring out the
find portion.
Thanks.
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
On Error GoTo Exits:
If Selection.Rows.Count > 1 Then
Set Rng = Selection
Else
Set Rng = Range(Rows(1),
Rows(ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row()))
End If
RwCnt = 0
For Rw = Rng.Rows.Count To 1 Step -1
If Rng.Rows(Rw).entirerow.find( lookin: sheets("Sheet1"))= true Then
Rng.Rows(Rw).EntireRow.Hidden = True
RwCnt = RwCnt + 1
End If
Next Rw
Exits:
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
sheet1 data
2 a
5 b
12 c
sheet2 data
2
3
4
I would like to write a macro as follows:
if I find the value in column a of sheet 1 IN column a in sheet 2, hide that
column in sheet one (loop for the range of cells).
I have the following so far: I am clearly having trouble figuring out the
find portion.
Thanks.
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
On Error GoTo Exits:
If Selection.Rows.Count > 1 Then
Set Rng = Selection
Else
Set Rng = Range(Rows(1),
Rows(ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row()))
End If
RwCnt = 0
For Rw = Rng.Rows.Count To 1 Step -1
If Rng.Rows(Rw).entirerow.find( lookin: sheets("Sheet1"))= true Then
Rng.Rows(Rw).EntireRow.Hidden = True
RwCnt = RwCnt + 1
End If
Next Rw
Exits:
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub