ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto Expend Range Using Macro (https://www.excelbanter.com/excel-programming/295155-auto-expend-range-using-macro.html)

taych

Auto Expend Range Using Macro
 
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

--
Message posted from http://www.ExcelForum.com


BrianB

Auto Expend Range Using Macro
 
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
'----------------------------------------

--
Message posted from http://www.ExcelForum.com


taych[_2_]

Auto Expend Range Using Macro
 
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

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 08:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com