View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
INTP56 INTP56 is offline
external usenet poster
 
Posts: 66
Default Range ("1:7") With Variables?

This demonstrates another way to do this with Excel objects:

Option Explicit

Public Sub RowSelect(WS As Worksheet, intRow1 As Integer, intRow2 As Integer)
Dim rngTest As Range
With WS
Set rngTest = .Range(.Rows(intRow1), .Rows(intRow2))
End With
rngTest.Select
End Sub

Public Sub TestRowSelect()
RowSelect WS:=ThisWorkbook.Worksheets(1), intRow1:=1, intRow2:=7
End Sub

Bob

"J@Y" wrote:

How would I express Range ("1:7") by replacing the 1 and the 7 with integer
variables?