Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8654677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:50:47+00:00 2026-06-12T14:50:47+00:00

I’m totally new to macros and VB so would be grateful for any help.

  • 0

I’m totally new to macros and VB so would be grateful for any help.
I have excel data in this form:

Clip    PSNR-codec1     PSNR-codec2     Bit Rates 
Video1  29.426086       29.220891       94357
Video1  31.207342       31.703124       322832
Video1  34.474587       34.255598       633468
Video1  36.445279       35.479189       936961
Video1  39.093937       36.4768         1539093
Video2  41.156012       37.295318       326742
Video2  43.355358       37.684239       604494
Video2  29.95337        29.30644        1218206
Video2  32.040252       30.837518       1809751
Video2  34.194409       32.774954       2387549
Video3  35.495356       33.806537       1567065
Video3  36.395173       34.544676       2173151
Video3  37.077718       35.234943       3094348
Video3  35.681498       36.036972       3240981
Video3  171.661771      83.104314       3355959
Video4  171.247791      96.978608       5103370
Video4  185.239286      128.064048      6636778
Video4  189.115735      115.418461      8150015
Video4  185.35225       154.3189011     2345629

My requirement is to create a chart of type “XYScatterSmooth” in a separate sheet for each video. The graph should have bit rates on X axis and PSNR on Y-axis. Going forward , we will have data for more videos too. So how do I write a macro which will repeat these steps for each video (i.e Loop should repeat for every 5 lines . 5 lines of data is fixed number)

Excel Version: 2010

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:50:48+00:00Added an answer on June 12, 2026 at 2:50 pm

    This worked for me with the sample data you provided.

    Put all your data on sheet one, delete any other sheets. Your data needs to start on row 2 (as above). The macro will ask you the total number of videos (I find this easier than looping until an empty cell), then create the charts on a new sheet. It names the sheets Video1, Video2, etc.

    Let me know if it works out for you.

    Private Sub BitRateCharts()
    
    ' Data should be on Sheet 1. Delete all other sheets.
    
    
        Dim nVideoNum As Integer
        nVideoNum = 1
    
        Dim n As Integer
        n = 1
    
        Dim nStart As Integer
        nStart = 2
    
        Dim nLast As Integer
        nLast = 6
    
        Dim nVideos As Integer
        nVideos = InputBox("How many videos?")
    
        Dim nSheetNum
        nSheetNum = ActiveSheet.Index
    
        Do Until n > nVideos
    
        nSheetNum = ActiveSheet.Index
            If nSheetNum = ThisWorkbook.Sheets.Count Then
                Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = "Video" & nVideoNum
            Else
            End If
    
                ActiveSheet.Shapes.AddChart.Select
                ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
                ActiveChart.SetSourceData Source:=Range("Sheet1!$B$" & nStart & ":$D$" & nLast & "")
                ActiveChart.SeriesCollection(1).XValues = "=Sheet1!$D$" & nStart & ":$D$" & nLast & ""
                ActiveChart.SeriesCollection(1).Values = "=Sheet1!$B$" & nStart & ":$B$" & nLast & ""
                ActiveChart.SeriesCollection(2).XValues = "=Sheet1!$D$" & nStart & ":$D$" & nLast & ""
                ActiveChart.SeriesCollection(2).Values = "=Sheet1!$C$" & nStart & ":$C$" & nLast & ""
                ActiveChart.SeriesCollection(1).Name = "=""PSNR-Codec1"""
                ActiveChart.SeriesCollection(2).Name = "=""PSNR-codec2"""
    
                n = n + 1
    
                nVideoNum = nVideoNum + 1
    
                nStart = nStart + 5
                nLast = nLast + 5
        Loop
    
        MsgBox ("Macro Complete.")
    
    Exit Sub
    
    ErrMsg:
    
        MsgBox ("Error encountered. Macro could not complete.")
    
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
I have a text area in my form which accepts all possible characters from
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.