Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this
Range("A1:D" & Range("D1").End(xlDown).Row).Select --- Message posted from http://www.ExcelForum.com/ |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I enter formula sum(range+range)*0.15 sumif(range=3) | Excel Discussion (Misc queries) | |||
Cond. Format Data Bars of range based on values of another range | Excel Worksheet Functions | |||
Excel Addin:Setting the range to the Excel.Range object range prop | Excel Worksheet Functions | |||
formula to sort a range so that it matches the exact rows of a column that is outside that range? | Excel Discussion (Misc queries) | |||
how to? set my range= my UDF argument (range vs. value in range) [advanced?] | Excel Programming |