Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a fixed range of cells (41) that I need to chart. The user may or may
not fill all the final cells. I need to exclude these unused cells at the end from the chart. Dim LastColReservedCell As Integer Dim LastActiveCell As Integer Dim MyRange As Range LastActiveCell = 0 LastColReservedCell = 41 For Each c In Worksheets("Charts").Range _ ("B1:B41").Cells If c.Value < 1 Then Blanks = Blanks + 1 Else Blanks = Blanks End If Next LastActiveCell = LastColReservedCell - Blanks 'Here is where the problem starts. Trying to build the range generates an error 13. MyRange = "A1:" + LastActiveCell 'If I can build a valid Range, I would like to use it as shown below: ActiveChart.SetSourceData Source:=Sheets("Charts").Range(MyRange), PlotBy _ :=xlColumns 'Using (MyRange) instead of ("A1:B41") Is this possible? Thank You for your help. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Build Select Case Programmatically | Excel Programming | |||
Build a range from a cell | Excel Programming | |||
How to build a forward/back range finder | Excel Programming | |||
How do I programmatically specify a range. | Excel Programming | |||
How to build build a macro that automatically imports | Excel Programming |