Auto Expend Range Using Macro

  • Thread starter Thread starter taych
  • Start date Start date
T

taych

I would like to use macro to auto select my range of data, say A1:M50
which is expendable or contractible.

What command should I include in the macro?

Many thank
 
Something like this ? ...........

'-----------------------------------------
Sub test()
Dim MyRange As Range
Dim Rw1 As Long
Dim Col1 As Integer
Dim Rw2 As Long
Dim Col2 As Integer
'--------------------------
Rw1 = 1 ' Row 1
Col1 = 1 ' Column 1
Rw2 = 50 ' Row 50
Col2 = 13 'Column M
Set MyRange = ActiveSheet.Range(Cells(Rw1, Col1), Cells(Rw2
Col2))
MyRange.Select

End Sub
'----------------------------------------
 
Thanks BrianB for the help, but it does not seems to work for me, mayb
I did posted my problems incorrectly or not clearly.

What I actually want is if the range is to be expended to A1:M70 fro
A1:M50, the macro will automatically select the new range
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top