![]() |
Urgent Macro help
Hi All,
Please Need help. I have a function below that needs to be twicked so that i can use it. I am trying to apply the second row valuse to the datalables. Can some one please give me a simpler version of this function so that I can impliment it and understand as to what is happening so that i can learn from it. Sub customdatalabels(ActiveChart, columns, measures) Dim r Dim c Dim val Set rval = False For r = 1 To r <= measures For c = 1 To c <= columns val = Activesheet.Range(col(c) + (r + 1)).Value If (val < undefined & val < "") Then rval = True If (ActiveChart.PlotBy = 2) Then ActiveChart.SeriesCollection.Item(c).Points.Item(r ).DataLabel.Text = val Else ActiveChart.SeriesCollection.Item(r).Points.Item(c ).DataLabel.Text = val Datasheet.Rows.Item(r + 2).Delete rval End Sub What I understan is that I am looping through the columns and rows and then going to the send row and getting the valuse for each column and then appling that to the datalable. Now I also see that there is reference to col which seems to be an external function that reads the column names like A, B, C etc... I was wondering if some one cna give an work around this so that I do not have to use that external function col and still reference the columns in a way that i can use them in the function above. Any and All help will be very much appreciated. Thanks a bunch folks for being there Yesh |
Urgent Macro help
Hello Yesh, It looks like the code is extracting the value of a single cell within the Range. Change your code to this... val = Activesheet.Cells(r+ 1, c ).Value It doesn't need to be reconverted into "A1" format. Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=479853 |
Urgent Macro help
Sub customdatalabels(ActiveChart, columns, measures)
Dim r Dim c Dim val Set rval = False For r = 1 To measures For c = 1 To columns val = Activesheet.Cells(r+1,c).Value If (val < undefined & val < "") Then rval = True If (ActiveChart.PlotBy = 2) Then ActiveChart.SeriesCollection.Item(c).Points.Item(r ).DataLabel.Text = val Else ActiveChart.SeriesCollection.Item(r).Points.Item(c ).DataLabel.Text = val Datasheet.Rows.Item(r + 2).Delete rval End Sub -- Regards, Tom Ogilvy "Yeshwin" wrote in message ... Hi All, Please Need help. I have a function below that needs to be twicked so that i can use it. I am trying to apply the second row valuse to the datalables. Can some one please give me a simpler version of this function so that I can impliment it and understand as to what is happening so that i can learn from it. Sub customdatalabels(ActiveChart, columns, measures) Dim r Dim c Dim val Set rval = False For r = 1 To r <= measures For c = 1 To c <= columns val = Activesheet.Range(col(c) + (r + 1)).Value If (val < undefined & val < "") Then rval = True If (ActiveChart.PlotBy = 2) Then ActiveChart.SeriesCollection.Item(c).Points.Item(r ).DataLabel.Text = val Else ActiveChart.SeriesCollection.Item(r).Points.Item(c ).DataLabel.Text = val Datasheet.Rows.Item(r + 2).Delete rval End Sub What I understan is that I am looping through the columns and rows and then going to the send row and getting the valuse for each column and then appling that to the datalable. Now I also see that there is reference to col which seems to be an external function that reads the column names like A, B, C etc... I was wondering if some one cna give an work around this so that I do not have to use that external function col and still reference the columns in a way that i can use them in the function above. Any and All help will be very much appreciated. Thanks a bunch folks for being there Yesh |
All times are GMT +1. The time now is 07:05 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com