+ Reply to Thread
Results 1 to 16 of 16

VBA Macro - Newbie

  1. #1
    Registered User
    Join Date
    04-20-2016
    Location
    Glasgow
    MS-Off Ver
    2010
    Posts
    13

    VBA Macro - Newbie

    Hi All, I was wondering if anyone was able to assist, I've been asked to pull together a macro whereby i can generate a graph of sales figures for the past 4 years for all stores. I really don't even know where to start with VBA and have been trying different code that to see if i can edit it but to no avail. Essentially my data is in 6 columns; A being the branch and B to F the sales figures.

    Would love to keep it simple and many thanks in advance for any help you can provide.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: VBA Macro - Newbie

    without VBA.

    Try pivot table for that kind of work.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    04-20-2016
    Location
    Glasgow
    MS-Off Ver
    2010
    Posts
    13

    Re: VBA Macro - Newbie

    Thanks for your reply, unfortunatelypivots won't be enough as there are hundreds of branches and the request is to specifically generate them with the touch of a button via a macro...

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: VBA Macro - Newbie

    1) you are familiar with the strenght of pivot table?

    You are asked to do it with a touch of a button.
    2) are you familiar with VBA?

    I expect you have pushed into a way of solving the problem (e.g. VBA), but i expect the main goal is to solve the problem (so other options are also welcome).

  5. #5
    Registered User
    Join Date
    04-20-2016
    Location
    Glasgow
    MS-Off Ver
    2010
    Posts
    13

    Re: VBA Macro - Newbie

    Very much so in relation to pivots, and no I have not much experience of VBA at all and yes I wholeheartedly agree that the solution is the main goal but apparently 'practice will help me learn'...

  6. #6
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: VBA Macro - Newbie

    Then show the result to your boss using pivot table, and ask him/her if it is acceptable.

    I can't help yoo enough with VBA.

    You could help other forummembers adding a small excel file, without confidental information.

    Please also show (manualy) the expected result in your file.

  7. #7
    Registered User
    Join Date
    04-20-2016
    Location
    Glasgow
    MS-Off Ver
    2010
    Posts
    13

    Re: VBA Macro - Newbie

    Thank you for that advice, it is greatly appreciated. The data looks asset out in the table below:

    Branch Profit 1Profit 2Profit 3Profit 4Profit 5
    Store 1 £100.00 £120.00 £130.00 £140.00 £245.00
    Store 2 £340.00 £300.00 £222.00 £212.00 £400.00
    Store 3 £230.00 £211.00 £232.00 £400.00 £200.00
    Store 4 £150.00 £100.00 £100.00 £400.00 £500.00

    and the expected result is a graph per store showing the figures for the 5 time periods.

    I have managed to work with the VBA to generate a graph, just not the multiple graphs required.

  8. #8
    Registered User
    Join Date
    04-20-2016
    Location
    Glasgow
    MS-Off Ver
    2010
    Posts
    13

    Re: VBA Macro - Newbie

    Essentially I have this to generate one graph;

    Sub Macro1()
    '
    ' Macro1 Macro
    '

    '
    Range("A1:F2").Select
    ActiveSheet.Shapes.AddChart.Select
    ActiveChart.ChartType = xlLine
    ActiveChart.SetSourceData Source:=Range("'Working Data'!$A$1:$F$2")

    End Sub


    I guess i'm asking whether or not i need to replicate this for the other 200 odd rows in the data set within the code or if there is another way to establish each row as a graph?

  9. #9
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: VBA Macro - Newbie

    2 things about your comments:

    1)
    Please Login or Register  to view this content.
    2) add your code between tags #, according to the forumrules.

  10. #10
    Registered User
    Join Date
    04-20-2016
    Location
    Glasgow
    MS-Off Ver
    2010
    Posts
    13

    Re: VBA Macro - Newbie

    Apologies, i couldn't seem to upload the excel file I had saved the table to and I will resubmit the code between tags as per the forum rules. Apologies once again...

    Please Login or Register  to view this content.
    I have used the wrap code icon to fix the code as requested, I do hope this is now correct.

  11. #11
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: VBA Macro - Newbie

    1. It would help to see the workbook.

    You get better help on your question if you add a small excel file, without confidential information.

    Please also add manualy the expected result in your file.

    To Attach a File:

    1. Scroll down to the window below your post Additional Options
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.

  12. #12
    Registered User
    Join Date
    04-20-2016
    Location
    Glasgow
    MS-Off Ver
    2010
    Posts
    13

    Re: VBA Macro - Newbie

    Hopefully the data in the test file has attached now.

    Many Thanks,

    Apologies, i can see the data has not uploaded, when i upload the file from the pc, i have uploaded and then closed the window after the file is there, but i cannot see it
    Last edited by gigglesmumpty; 05-05-2016 at 04:35 AM.

  13. #13
    Registered User
    Join Date
    04-20-2016
    Location
    Glasgow
    MS-Off Ver
    2010
    Posts
    13

    Re: VBA Macro - Newbie

    I will try to upload the text data again. Many Thanks

    Hopefully the 'test' excel file has now uploaded correctly?
    Attached Files Attached Files

  14. #14
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: VBA Macro - Newbie

    with a macro to re-arange the data so we can easily use a pivot table.

    after that a pivot table and pivot graph.

    see the attached file.

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    04-20-2016
    Location
    Glasgow
    MS-Off Ver
    2010
    Posts
    13

    Re: VBA Macro - Newbie

    That is great!!! Thank you so very very much!! I really appreciate your help and patience!

  16. #16
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: VBA Macro - Newbie

    You're welcome. We appreciate the feedback!

    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

    It'd also be appreciated if you were to click the add Reputation button at the foot of any of the posts of those who helped you reach a solution.



    off the record:

    It is Liberty day in our country today, and a lot of your country members helped in the worldwar II to free our country. Thank you for that.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Hellos, another newbie here. An old newbie 31 years just started to use VBA!
    By vba_newbie83 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 08-31-2014, 03:37 AM
  2. Newbie in Macro
    By Carbonlink in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 01-20-2014, 07:45 PM
  3. [SOLVED] VBA Newbie needs some help with looping macro
    By CDNcameron in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-08-2012, 12:53 PM
  4. Need help with a Excel Macro (I am a Newbie)
    By theebookzoo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-13-2008, 08:36 AM
  5. Newbie: VBA? Macro? Please Advise...
    By pollywog1961 in forum Excel General
    Replies: 1
    Last Post: 05-29-2006, 02:57 PM
  6. newbie macro question
    By Knox in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-14-2006, 01:10 AM
  7. Newbie - Help with a macro
    By Mike Basden in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-08-2006, 08:40 PM

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