+ Reply to Thread
Results 1 to 3 of 3

Urgent Macro help

  1. #1
    Yeshwin
    Guest

    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



  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    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

  3. #3
    Tom Ogilvy
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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
    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1