![]() |
dyanmic range
I am trying to plot a graph in VBA using a selected range.
However I only want the range to incorporate column A and D, which will expand over time. How Can I express the following so that the range updates dynamically when new rows are entered? Range("A1:A23,D1:D23").Select Tried this, but does not work at all: Range(Range("A1").End(xlDown), Range("D1").End(xlDown)).Select Thank you. |
dyanmic range
Steve,
This should work: range(range("A1"), range("A1").End(xlDown).Resize(,4)).Select John "Steve" wrote in message ... I am trying to plot a graph in VBA using a selected range. However I only want the range to incorporate column A and D, which will expand over time. How Can I express the following so that the range updates dynamically when new rows are entered? Range("A1:A23,D1:D23").Select Tried this, but does not work at all: Range(Range("A1").End(xlDown), Range("D1").End(xlDown)).Select Thank you. |
dyanmic range
Try this
Range("A1:D" & Range("D1").End(xlDown).Row).Select --- Message posted from http://www.ExcelForum.com/ |
dyanmic range
Steve,
Just for clarification..... My example will give select the range based on the last cell in column "A" (looking downward) while mudrakers will select you the range based on the last cell in Column "D" (looking downward). Having looked at the posts, the following is yet another way: (There are plenty of other ways to do this, I'm sure.) range("A1").currentregion.Resize(,4).Select The above uses A1 as a starting point and selects the entire contiguous range of cells and then just resizes the columns to 4. John "Steve" wrote in message ... I am trying to plot a graph in VBA using a selected range. However I only want the range to incorporate column A and D, which will expand over time. How Can I express the following so that the range updates dynamically when new rows are entered? Range("A1:A23,D1:D23").Select Tried this, but does not work at all: Range(Range("A1").End(xlDown), Range("D1").End(xlDown)).Select Thank you. |
dyanmic range
Try this,
Sub Test() Dim LRow As Long LRow = Range("a1").End(xlDown).Row Range("A1:A" & LRow & ",D1:D" & LRow).Select End Sub Regards, Shah Shailesh http://members.lycos.co.uk/shahweb/ *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
All times are GMT +1. The time now is 11:50 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com