Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Macro to select cells at current cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Macro to select cells at current cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Macro to select cells at current cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to select cells at current cell


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 913
Default Macro to select cells at current cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Macro to select cells at current cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 913
Default Macro to select cells at current cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Macro to select cells at current cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Macro to select cells at current cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Macro to select cells at current cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 913
Default Macro to select cells at current cell

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
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
VBA - Select: current cell + next 19 cells (down in column) = rang Chris T-M Excel Programming 2 November 7th 08 11:14 AM
Data: select a cell x rows below the current, where x is designate manxman Excel Discussion (Misc queries) 1 July 18th 06 05:32 PM
Macro €“ select all cells in current range Mary Ann Excel Discussion (Misc queries) 3 December 12th 05 07:19 AM
Macro to select cells within a range in which the cell color is none PCLIVE Excel Programming 9 October 18th 05 06:57 PM
Want macro to select current cell rdaugherty Excel Programming 9 October 13th 05 04:35 PM


All times are GMT +1. The time now is 04:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"