Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi there,
Can a VB macro be written to hide 3 rows at the cell position - no matter where the current cell position is. I can write a macro to select specific row numbers, but I want one that will take the 3 rows from the current cell. Thanks! Amy |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
yes, specify which 3 rows and someone will help you
-- Gary "cvgairport" wrote in message ... Hi there, Can a VB macro be written to hide 3 rows at the cell position - no matter where the current cell position is. I can write a macro to select specific row numbers, but I want one that will take the 3 rows from the current cell. Thanks! Amy |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Amy,
You certainly can ========================================== Sub Hide3Rows() qrow = ActiveCell.Row Rows(qrow & ":" & qrow + 2).EntireRow.Hidden = True End Sub ========================================== Ant http://www.excel-ant.co.uk |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() This macro will hide the current row and the next two rows as well. Code: -------------------- Sub Hide3Rows() Range(Selection, Selection.Offset(2, 0)).Rows.Hidden = True End Sub -------------------- -- JBeaucaire ------------------------------------------------------------------------ JBeaucaire's Profile: http://www.thecodecage.com/forumz/member.php?userid=73 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=46712 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Mon, 5 Jan 2009 11:39:02 -0800, cvgairport
wrote: Hi there, Can a VB macro be written to hide 3 rows at the cell position - no matter where the current cell position is. I can write a macro to select specific row numbers, but I want one that will take the 3 rows from the current cell. Thanks! Amy Try this Selection.Resize(3, 1).EntireRow.Hidden = True This will hide the (top) row of the current selection together with the two following rows. Hope this helps / Lars-Åke |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
that's just it - it varies everytime I would want to execute the macro. I
want to hide a 3 row tall comment section from a deaprtmental expense analysis. It is a listing of accounts with comment boxes under each. I want to print the spreadhseet with the comment boxes hidden. I want to move down the spreadsheet and execute the macro to hide the comment box wherever I find them so the row numbers differ each time I execute the macro. "Gary Keramidas" wrote: yes, specify which 3 rows and someone will help you -- Gary "cvgairport" wrote in message ... Hi there, Can a VB macro be written to hide 3 rows at the cell position - no matter where the current cell position is. I can write a macro to select specific row numbers, but I want one that will take the 3 rows from the current cell. Thanks! Amy |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Mon, 05 Jan 2009 19:54:16 GMT, Lars-Åke Aspelin
wrote: On Mon, 5 Jan 2009 11:39:02 -0800, cvgairport wrote: Hi there, Can a VB macro be written to hide 3 rows at the cell position - no matter where the current cell position is. I can write a macro to select specific row numbers, but I want one that will take the 3 rows from the current cell. Thanks! Amy Try this Selection.Resize(3, 1).EntireRow.Hidden = True This will hide the (top) row of the current selection together with the two following rows. Hope this helps / Lars-Åke The above formula can be shortened a bit Selection.Resize(3, 1).Rows.Hidden = True Lars-Åke |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yeah! It worked! Thanks to all...
Amy "excel-ant" wrote: Hi Amy, You certainly can ========================================== Sub Hide3Rows() qrow = ActiveCell.Row Rows(qrow & ":" & qrow + 2).EntireRow.Hidden = True End Sub ========================================== Ant http://www.excel-ant.co.uk |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
what i meant was the rows above or below the active cell.
rows(activecell.Row).resize(2).entirerow.hidden=tr ue -- Gary "cvgairport" wrote in message ... that's just it - it varies everytime I would want to execute the macro. I want to hide a 3 row tall comment section from a deaprtmental expense analysis. It is a listing of accounts with comment boxes under each. I want to print the spreadhseet with the comment boxes hidden. I want to move down the spreadsheet and execute the macro to hide the comment box wherever I find them so the row numbers differ each time I execute the macro. "Gary Keramidas" wrote: yes, specify which 3 rows and someone will help you -- Gary "cvgairport" wrote in message ... Hi there, Can a VB macro be written to hide 3 rows at the cell position - no matter where the current cell position is. I can write a macro to select specific row numbers, but I want one that will take the 3 rows from the current cell. Thanks! Amy |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
but you wanted 3 rows, not 2 as in my previous post
rows(activecell.Row).resize(3).entirerow.hidden=tr ue -- Gary "cvgairport" wrote in message ... that's just it - it varies everytime I would want to execute the macro. I want to hide a 3 row tall comment section from a deaprtmental expense analysis. It is a listing of accounts with comment boxes under each. I want to print the spreadhseet with the comment boxes hidden. I want to move down the spreadsheet and execute the macro to hide the comment box wherever I find them so the row numbers differ each time I execute the macro. "Gary Keramidas" wrote: yes, specify which 3 rows and someone will help you -- Gary "cvgairport" wrote in message ... Hi there, Can a VB macro be written to hide 3 rows at the cell position - no matter where the current cell position is. I can write a macro to select specific row numbers, but I want one that will take the 3 rows from the current cell. Thanks! Amy |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Mon, 05 Jan 2009 20:01:41 GMT, Lars-Åke Aspelin
wrote: On Mon, 05 Jan 2009 19:54:16 GMT, Lars-Åke Aspelin wrote: On Mon, 5 Jan 2009 11:39:02 -0800, cvgairport wrote: Hi there, Can a VB macro be written to hide 3 rows at the cell position - no matter where the current cell position is. I can write a macro to select specific row numbers, but I want one that will take the 3 rows from the current cell. Thanks! Amy Try this Selection.Resize(3, 1).EntireRow.Hidden = True This will hide the (top) row of the current selection together with the two following rows. Hope this helps / Lars-Åke The above formula can be shortened a bit Selection.Resize(3, 1).Rows.Hidden = True Lars-Åke Even shorter :-) Selection.Resize(3).Rows.Hidden = True Lars-Åke |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA - Select: current cell + next 19 cells (down in column) = rang | Excel Programming | |||
Data: select a cell x rows below the current, where x is designate | Excel Discussion (Misc queries) | |||
Macro €“ select all cells in current range | Excel Discussion (Misc queries) | |||
Macro to select cells within a range in which the cell color is none | Excel Programming | |||
Want macro to select current cell | Excel Programming |