Unhiding a row automatically if text is returned

davidhall

Board Regular
Joined
Mar 6, 2011
Messages
174
I need some assistance please. I am running a vlookup function that returns text to a specified cell if the value my vlookup is referencing appears. I have several vlookups in column "A" of worksheet 1 that reference data in column "A" of worksheet 2. In worksheet 1, there is always a list of lets say accounts that are returned from worksheet 2 because they are consistently part of the data I analyze. On the other hand, there are times when other accounts appear on worksheet 2 that I need to appear on worksheet 1, but only if they show up. The vlookup function will return the value but I want the row to appear or unhide if the vlookup returns the value, otherwise the row should remain hidden.

Right now, I have a set of additional rows hidden but can easily be unhidden when data populates a cell. A macro I currently have unhides all the hidden cells whereas I only want the cells with data in them to unhide.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi

Not sure I fully understood the question, but try this, but from the sounds of it, you may have already have this solution. This code can be run through a command button placed on the sheet or via an event.

Code:
Application.ScreenUpdating = False
For Each vammount In Range("a1:a100") ' Range of cells to be lookedat
 
    If vammount > 0 Then ' Criteria
 
        vammount.EntireRow.Hidden = False
        
    Else: vammount.EntireRow.Hidden = True
 
    End If
    
Next vammount

regards
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top