add ranges

  • Thread starter Thread starter RobcPettit
  • Start date Start date
R

RobcPettit

Hi, Id like to know if its possible with vba to add number of rows to
a given range so I can then select those cells. If my range is "A3"
and I want to add 30 rows, so A3 + 30 = A3:A33. The number to be
added is not static and changes depending on previous results.
regards Robert
 
try this macro

Code:
Sub test()
 Dim r As String, j As Integer, r1 As Range
  r = InputBox("type the range address e.g. A3")
  j = InputBox("type the no. of rows you want to offset .e.g 30")
 Set r1 = Range(Range(r), Range(r).Offset(j, 1))
 MsgBox r1.Address
 End Sub
 
Back
Top