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 8208167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:14:52+00:00 2026-06-07T09:14:52+00:00

I have an excel sheet that I am wanting to extract data from and

  • 0

I have an excel sheet that I am wanting to extract data from and represent the data as graphs on a new tab called “graphs”.

I am able to generate the graphs quite easily, but when they are created they are all stacked upon each other as I am unable to find a decent and simple way to give them set position that I can increment after each loop completion.

I have been trying activechart.location commands but cannot seem to find the right one.

Here is my code at the moment. This generates the charts and outputs them to the current excel sheet.

Dim i As Integer
i = 30
Start = Start + 2 (global variable)
finish = finish + 2 (global variable)
For i = 30 To 56
   Range("ci:bbi").Select
   ActiveSheet.Shapes.AddChart.Select
   ActiveChart.HasTitle = True
   ActiveChart.ChartTitle.Text = Cells(i, 2).Value
   ActiveChart.SourceData Source:=Range(Cells(i, Start), Cells(i, finish))
   ActiveChart.ChartType = xlColumnStacked
Next

I am completely new to vba and even this small block of code is taking a lot of effort!
My question is, what can i put in here, to give a position for each chart as i create it to position it. Preferably a new variable I can increment.

Thanks in advance

EDIT: Forgot to mention, I am not able to do this with a macro as I need the page to be used multiple times, using a macro means that the graph names are used to identify them, so it becomes impossible to track the graphs after the first generation of graphs as the chart names continue to go higher and higher.

  • 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-07T09:14:54+00:00Added an answer on June 7, 2026 at 9:14 am

    Try this

    Sub Sample()
        Dim i As Long, nTop As Long, nLeft As Long
        Dim strChrt As String
    
        i = 30: nLeft = 20: nTop = 20
        
        Start = Start + 2: finish = finish + 2
        
        For i = 30 To 56
           ActiveSheet.Shapes.AddChart.Select
           ActiveChart.HasTitle = True
           ActiveChart.ChartTitle.Text = Cells(i, 2).Value
           ActiveChart.SetSourceData Source:=Range(Cells(i, Start), Cells(i, finish))
           ActiveChart.ChartType = xlColumnStacked
           
           strChrt = Trim(Replace(ActiveChart.Name, ActiveSheet.Name, ""))
    
           ActiveSheet.Shapes(strChrt).Left = nLeft
           ActiveSheet.Shapes(strChrt).Top = nTop
    
           '~~> Increment the next `Top` placement for the chart
           nTop = nTop + ActiveSheet.Shapes(strChrt).Height + 20
        Next
    End Sub
    

    I have created two variables nTop and nLeft which will define the position of the newly created graphs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Excel sheet now I need to insert data from that sheet
I have an Excel sheet that I am using to populate data in a
I have some strings in Java (originally from an Excel sheet) that I presume
I have created an Excel Sheet that does some lookups to format data that
I have an excel sheet that I want to load into a datatable withe
I have an excel sheet that is organized as follows: COL1 COL2 1 30
I have the this code that will create excel file and work sheet then
I have a Excel sheet with two columns and I need to create new
I have just Extracted the cells from the excel sheet using Apache POI, everything
I am working on writing the data into Excel sheet in c#. I have

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.