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

  • Home
  • SEARCH
  • 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 8610937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:14:48+00:00 2026-06-12T04:14:48+00:00

Alright, I’ve been racking my brain, reading up excel programming for dummies, and looking

  • 0

Alright, I’ve been racking my brain, reading up excel programming for dummies, and looking all over the place but I’m stressing over this little problem I have here. I’m completely new to vba programming, or really any programming language but I’m trying my best to get a handle on it.

The Scenario and what my goal is:

The picture below is a sample of a huge long list of data I have from different stream stations. The sample only holds two (niobrara and snake) to illustrate my problem, but in reality I have a little over 80 stations worth of data, each varying in the amount of stress periods (COLUMN B).

COLUMN A, is the station name column.
COLUMN B, stress period number
COLUMN C, modeled rate
COLUMN D, estimated rate

What I have been TRYING to figure out is how to make a macro that will loop through the station names (COLUMN A) and for each UNIQUE Group of station names, make a chart that will pop out to the right of the group, say in the COLUMN E area.

The chart is completely simple, it just needs two series scatterplot/line chart; one series with COLUMN B as x-value and COLUMN C as y-value; and the other series needs COLUMN B as x-value and COLUMN D as y-value.

Now my main ordeal, is that I don’t know how to make the macro distinguish between station names, use all the data relating to that name to make the chart, then looping on to the next Station group and creating a chart that corresponds for that, and to continue looping through all 80+ station names in COLUMN A and to make the corresponding 80+ charts to the right of it all in somewhere like the COLUMN E.

If I had enough points to “bounty” this, I would in a heartbeat. But since I do not, whoever can solve my dilemma would receive my sincere gratitude in helping me understand run this problem smoothly and hopefully better my understanding of scenarios like this in the future. If there is anymore information that I need to clarify to make my question more understandable please comment your query and I’d be happy to explain in more detail the subject.

Cheers.

Oh, and for extra credit; now that I think about it, I manually entered the numbers in COLUMN B. Since the loop would need to use that column as the x-value it would be important if it could loop through itself and fill that column on its own before it made the chart (I would imagine it would have something to do with anything as simple as “counting out the rows that correspond to the station name”. But again, I know not the proper terminology to correspond the station name, hence the pickle I’m in; however if the veteran programmer who is savvy enough to answer this question could, I’d imagine such a piece of code would be simple enough yet crucial to the success of such a macro I seek.

enter image description here

  • 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-12T04:14:50+00:00Added an answer on June 12, 2026 at 4:14 am

    Try this

    Sub MakeCharts()
        Dim sh As Worksheet
        Dim rAllData As Range
        Dim rChartData As Range
        Dim cl As Range
        Dim rwStart As Long, rwCnt As Long
        Dim chrt As Chart
    
        Set sh = ActiveSheet
    
        With sh
            ' Get reference to all data
            Set rAllData = .Range(.[A1], .[A1].End(xlDown)).Resize(, 4)
            ' Get reference to first cell in data range
            rwStart = 1
            Set cl = rAllData.Cells(rwStart, 1)
            Do While cl <> ""
                ' cl points to first cell in a station data set
                ' Count rows in current data set
                rwCnt = Application.WorksheetFunction. _
                   CountIfs(rAllData.Columns(1), cl.Value)
                ' Get reference to current data set range
                Set rChartData = rAllData.Cells(rwStart, 1).Resize(rwCnt, 4)
                With rChartData
                    ' Auto fill sequence number
                    .Cells(1, 2) = 1
                    .Cells(2, 2) = 2
                    .Cells(1, 2).Resize(2, 1).AutoFill _
                       Destination:=.Columns(2), Type:=xlFillSeries
                End With
                ' Create Chart next to data set
                Set chrt = .Shapes.AddChart(xlXYScatterLines, _
                   rChartData.Width, .Range(.[A1], cl).Height).Chart
                With chrt
                    .SetSourceData Source:=rChartData.Offset(0, 1).Resize(, 3)
                    ' --> Set any chart properties here
    
                    ' Add Title
                    .SetElement msoElementChartTitleCenteredOverlay
                    .ChartTitle.Caption = cl.Value
    
                    ' Adjust plot size to allow for title
                    .PlotArea.Height = .PlotArea.Height - .ChartTitle.Height
                    .PlotArea.Top = .PlotArea.Top + .ChartTitle.Height
    
                    ' Name series'
                    .SeriesCollection(1).Name = "=""Modeled"""
                    .SeriesCollection(2).Name = "=""Estimated"""
    
                    ' turn off markers
                    .SeriesCollection(1).MarkerStyle = -4142 
                    .SeriesCollection(2).MarkerStyle = -4142 
    
                End With
    
                ' Get next data set
                rwStart = rwStart + rwCnt
                Set cl = rAllData.Cells(rwStart, 1)
            Loop
    
        End With
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright so I have been looking around (on SO and Google) to see if
Alright, so I'm new to Android programming, so far my experience has been quite
Alright. This may be difficult but I have been struggling for quite a bit
Alright I've been debugging the whole day but can't figure out what the problem
Alright, this is driving me nuts because my regex is working on Rubular, but
Alright so I have no idea how to even begin doing this But basically
Alright y'all. I am attempting to write a bit of code that places typographic
Alright I'm pretty new to programming and stuff and I'm now trying to code
Alright, I'm not the best with JOIN's and after all these years of working
Alright, so I've been trying to implement a simple binary search tree that uses

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.