View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
PedroPastre PedroPastre is offline
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