Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default selecting current row plus the 2 above

Here's one more for you to consider...

Rows((ActiveCell.Row - 2) & ":" & ActiveCell.Row).Select

Although you might want to put in a check to make sure the active cell is at
Row 3 or greater...

If ActiveCell.Row 2 Then Rows((ActiveCell.Row - 2) & _
":" & ActiveCell.Row).Select

And, if you use a With block whose reference is the ActiveCell then either
this...

With ActiveCell
.....
Rows((.Row - 2) & ":" & .Row).Select
.....
End With

or this...

With ActiveCell
.....
If .Row 2 Then Rows((.Row - 2) & ":" & .Row).Select
.....
End With

depending on if you need to check the active cell's row number for being
greater than 2 or not.

--
Rick (MVP - Excel)


"RocketRod" wrote in message
...
Can someone show me the code to select the current row and the 2 above it?


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
Selecting dates from current week with Macro Gemz Excel Programming 5 February 15th 08 04:46 PM
Selecting current range for pivot macro Math[_2_] Excel Programming 4 February 4th 08 05:25 PM
Selecting Current date Jim May Excel Discussion (Misc queries) 4 August 22nd 06 09:23 PM
SELECTING CURRENT DATE AT OPENING R VAN DEURSEN Excel Worksheet Functions 5 March 7th 05 07:38 AM
selecting current row information and transfering it. Alan M Excel Programming 3 December 15th 04 03:16 AM


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