Variable EntireRow Selection

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

Does anyone know if it is possible to use variables as in the following?

Dim myStart, myEnd As Integer
<...>
ActiveCell.Rows("myStart:myEnd").EntireRow.Select

When myStart = 1 and myEnd = 20, I get a type mismatch. I want it to behave
like this:

ActiveCell.Rows("1:20").EntireRow.Select

Thanks
 
You can use
ActiveCell.Rows(myStart).Resize(MyEnd+1-
MyStart).EntireRow.Select

or

ActiveCell.Range(myStart & ":" & myEnd).EntireRow.Select
 
Back
Top