Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hiding columns

Hi everyone, can anyone help !?

I have a table of information, from A19 to F50 where column has title
and B to F data. The table is linked to other worksheets using th
INDIRECT function and references cell A5 to get the appropriat
sheetname.

What I would like to do is create a VBA macro that will automaticall
hide the rows with no data in either column B or E. is this possible ?


Thanks for any and all help.

Best wishes
Scott

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Hiding columns

Hi Scott, This code will do that for you

Sub HideEmpty()
Dim r As Integer
For r = 19 To 50
If Range("B" & r).Value = "" Or Range("E" & r).Value = "" Then
Rows(r).EntireRow.Hidden = True
Next r
End Sub

Mike F

"scottwilsonx " wrote in
message ...
Hi everyone, can anyone help !?

I have a table of information, from A19 to F50 where column has titles
and B to F data. The table is linked to other worksheets using the
INDIRECT function and references cell A5 to get the appropriate
sheetname.

What I would like to do is create a VBA macro that will automatically
hide the rows with no data in either column B or E. is this possible ?


Thanks for any and all help.

Best wishes
Scott.


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hiding columns

Someting like this :-


Code
-------------------
Sub HideRows()
For r = 20 To 50
If Cells(r, 2).Value = "" Or Cells(r, 5).Value = "" Then
Rows(r).EntireRow.Hidden = True
End If
Next
End Sub

-------------------


--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hiding columns

Thanks both,

Not sure if I am missing something simple. But the following code won'
run, and instead gives me the following error "compile error nex
without for". Any ideas !?

Thanks

Sub HideEmpty()
Dim r As Integer
For r = 19 To 50
If Range("B" & r).Value = "" Or Range("E" & r).Value = "" Then
Rows(r).EntireRow.Hidden = True
Next r
End Sub

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hiding columns

Sorry everyone, Ive worked it out. Missing an End If !
Thanks for your help.

Best wishes
Scott

--
Message posted from http://www.ExcelForum.com

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
Hiding Columns SnareHiHat Excel Discussion (Misc queries) 2 October 16th 09 02:10 PM
Hiding Columns Gord Dibben Excel Discussion (Misc queries) 0 February 25th 09 08:49 PM
hiding columns [email protected] Excel Discussion (Misc queries) 3 July 12th 06 04:42 PM
Hiding Columns belony Excel Discussion (Misc queries) 4 June 15th 05 12:27 AM
Not Hiding Columns SS[_3_] Excel Programming 1 February 11th 04 10:27 PM


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