Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default hiding row if the cell is found in a differeent column

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(xlCellTypeLast Cell).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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a range by going down a column until an empty cell is found JIm Samson Excel Programming 2 March 22nd 09 05:22 PM
Hiding all rows where the cell value in column 13 of same row = $0.00 [email protected] Excel Programming 1 May 24th 07 07:28 AM
Hiding all rows where the cell value in column 13 of same row = $0.00 [email protected] Excel Programming 1 May 24th 07 02:17 AM
Hiding column if cell in previous column is empty-revised [email protected] Excel Programming 2 January 4th 07 06:45 AM
determine the column where a cell was found usadream[_3_] Excel Programming 3 March 24th 06 01:55 PM


All times are GMT +1. The time now is 03:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"