Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi.
I'm having trouble referring to the column when creating a chart. The following statement will work, but the "W170" will actually be variable and I don't know how to refer to the last column letter in the range statement. I do have a variable called "lastColumn" that givese me the number of the last column, but I don't know how to find the letter for the range statement. Can someone tell me how to do this? ActiveChart.SetSourceData Source:=Sheets("By Hour").Range("A1:W170"), PlotBy _ :=xlColumns |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() maybe this Range(Cells(1, "A"), Cells(170, lastcolumn)) -- Gary "Mike D." wrote in message ... Hi. I'm having trouble referring to the column when creating a chart. The following statement will work, but the "W170" will actually be variable and I don't know how to refer to the last column letter in the range statement. I do have a variable called "lastColumn" that givese me the number of the last column, but I don't know how to find the letter for the range statement. Can someone tell me how to do this? ActiveChart.SetSourceData Source:=Sheets("By Hour").Range("A1:W170"), PlotBy _ :=xlColumns |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You might try this . . . By using CurrentRegion your data range will
automatically expand and contract as data is added to removed. Then you could do away with the "lastcolumn" variable. ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1").CurrentRegion , PlotBy:=xlColumns -- John Mansfield http://cellmatrix.net "Mike D." wrote: Hi. I'm having trouble referring to the column when creating a chart. The following statement will work, but the "W170" will actually be variable and I don't know how to refer to the last column letter in the range statement. I do have a variable called "lastColumn" that givese me the number of the last column, but I don't know how to find the letter for the range statement. Can someone tell me how to do this? ActiveChart.SetSourceData Source:=Sheets("By Hour").Range("A1:W170"), PlotBy _ :=xlColumns |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IF STATEMENT Range | Excel Discussion (Misc queries) | |||
range in an IF statement | Excel Worksheet Functions | |||
IF statement with a range | Excel Worksheet Functions | |||
Use a range name in VB with IF Then Else statement | Excel Discussion (Misc queries) | |||
Set range statement | Excel Programming |