Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default VARIABLES IN ROWS - Help on The Right Syntax

I have a strong need to select any row and the immediate row. I know
definite rows can be selected as - Rows("20:21").Select . Whenever I
try a variableble like Rows("Z:Z+1") or Rows(Z:Z+1) it usually doesnt
work.

The attempt is shown below:

Range("K" & Z).Select
If Range("K" & Z).Value < 1 And Abs(Range("K" & Z).Value) =
Abs(Range("K" & Z + 1).Value)
Rows("Z:Z+1").Select
Selection.Cut
Sheets("bin").Select
Range("A" & X).Select
ActiveSheet.Paste

Pls help on the right syntax

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VARIABLES IN ROWS - Help on The Right Syntax

Sylink,

you made a mistake at the line of code below:

Rows("Z:Z+1").Select

as you Z is a variable (probably a count) the correct syntax for this case is:

Rows(Z & ":" & Z + 1).Select

this will make your code run properly!

if you have any other doubt feel free to ask me!

PedroPastre

"sylink" wrote:

I have a strong need to select any row and the immediate row. I know
definite rows can be selected as - Rows("20:21").Select . Whenever I
try a variableble like Rows("Z:Z+1") or Rows(Z:Z+1) it usually doesnt
work.

The attempt is shown below:

Range("K" & Z).Select
If Range("K" & Z).Value < 1 And Abs(Range("K" & Z).Value) =
Abs(Range("K" & Z + 1).Value)
Rows("Z:Z+1").Select
Selection.Cut
Sheets("bin").Select
Range("A" & X).Select
ActiveSheet.Paste

Pls help on the right syntax


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default VARIABLES IN ROWS - Help on The Right Syntax

Dear Pedro

Perfectly correct. Appreciate

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
Deleting rows - syntax wrong? seed Excel Discussion (Misc queries) 4 March 3rd 09 07:57 PM
Syntax for using variables in a cell formula to reference paths/fi colorado808 Excel Worksheet Functions 4 March 15th 07 03:41 AM
Range.Select Using Variables - need syntax gradientS Excel Discussion (Misc queries) 3 February 16th 05 12:45 PM
Syntax for Countnig Rows Pete Excel Programming 1 June 14th 04 06:36 PM
Using variables with ROWs Michael[_20_] Excel Programming 2 October 17th 03 04:29 PM


All times are GMT +1. The time now is 01:46 PM.

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"