![]() |
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 |
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 |
VARIABLES IN ROWS - Help on The Right Syntax
Dear Pedro
Perfectly correct. Appreciate |
All times are GMT +1. The time now is 05:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com