Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JJO JJO is offline
external usenet poster
 
Posts: 1
Default How do I write a macro that hides a row based on data in Excel?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 595
Default How do I write a macro that hides a row based on data in Excel?

JJO

You should include your question in the body of your post and use the
subject line to show the subject. It makes it easier for others to read.
Here's an example of a macro that hides a row based on the value of a cell.

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Column = 1 Then 'only for column A
If Target.Value = "HideMe" Then
Application.EnableEvents = False
Target.EntireRow.Hidden = True
Application.EnableEvents = True
End If
End If

End Sub

For more on events, see here
http://www.dicks-blog.com/archives/2...ng-vba-events/

--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com

JJO wrote:


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default How do I write a macro that hides a row based on data in Excel?

Try something like

If Range("A1").Value 100 Then
Rows(3).Hidden = False
Else
Rows(3).Hidden = True
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"JJO" wrote in message
...



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I write a macro that hides a row based on data in Excel?


You can write something like:

If activecell = <your parameters then Selection.EntireRow.Hidden =
True

Tim


--
TimZ
------------------------------------------------------------------------
TimZ's Profile: http://www.excelforum.com/member.php...o&userid=23558
View this thread: http://www.excelforum.com/showthread...hreadid=373865

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
Write Macro to Fix Data Alignment (Data dump from Crystal to Excel Karin Excel Discussion (Misc queries) 2 September 22nd 09 05:31 PM
Write a macro that hides rows based on empty cells Mac0001UK Excel Discussion (Misc queries) 3 March 10th 09 12:37 PM
can I write an Excel macro to pause for data entry then continue? kiwiwaldo Excel Discussion (Misc queries) 3 June 30th 08 10:25 AM
is it possible to execute write to the fields in another .xsl form a macro in another .xsl? e.g. some way to load another .xsl into an .xsl macro and write to its data? Daniel Excel Worksheet Functions 1 June 23rd 05 11:38 PM
macro - hides everything and not just certain columns as recorded sonar[_6_] Excel Programming 4 May 2nd 04 03:35 PM


All times are GMT +1. The time now is 05:13 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"