Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Hiding Columns | Excel Discussion (Misc queries) | |||
Hiding Columns | Excel Discussion (Misc queries) | |||
hiding columns | Excel Discussion (Misc queries) | |||
Hiding Columns | Excel Discussion (Misc queries) | |||
Not Hiding Columns | Excel Programming |