Consulting

Results 1 to 3 of 3

Thread: Little help with Visual Basics

  1. #1
    VBAX Newbie
    Joined
    Nov 2011
    Posts
    4
    Location

    Little help with Visual Basics

    Hi,

    I'm making a macro to run a set of data and create a chart and process the things that I'm interested in. But kinda faced some problem

    1. Does anyone knows the code in visual basics to change the thickness of the lines in charts. The lines are those that joins the different points of data on the chart. It's a bit big, wanna change the thickness. I used record macro, but all it gives me is that i selected the seriesCollection.

    2. So far what I've noticed is that the macro function is "attached" to only the excel file I program it in. Is there a way to make it sort of like a user defined function, such that if i've got another new set of similar data in another excel file, I can just run the whole code, without the need to copy and paste the code from the old excel file in that new excel file.

    3. i've got this set of data, which has lots of decimal places, not sure what's the default data type when I didnt assign any. Coz it's like I did a calculation from a different set of data, (smth like whole of column B is column A/35). So how do I change the whole set in column B to 2 decimal places? Or what datatype should i use?


    Thanks alot!!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    With Worksheets("Sheet1").ChartObjects("Chart 1")

    With .Chart.SeriesCollection(2).Format.Line

    .Visible = msoTrue
    .Weight = 2#
    End With
    End With
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    Quote Originally Posted by iWiishh
    2. So far what I've noticed is that the macro function is "attached" to only the excel file I program it in. Is there a way to make it sort of like a user defined function, such that if i've got another new set of similar data in another excel file, I can just run the whole code, without the need to copy and paste the code from the old excel file in that new excel file.

    3. i've got this set of data, which has lots of decimal places, not sure what's the default data type when I didnt assign any. Coz it's like I did a calculation from a different set of data, (smth like whole of column B is column A/35). So how do I change the whole set in column B to 2 decimal places? Or what datatype should i use?
    2. You could FileSaveAs the workbook containing the macro as an Excel AddIn (.xlma) or put it in XLSTART. If you use the add in, remember there's a difference between ActiveWorkbook and ThisWorkbook. So if you're refrerring to anything in the macro-containing workbook, use Thisworkbook.Worksheets ( ...), etc.

    3. You can apply a number format to only display 2 decimals, while retaining full precision for calculations

    Paul

Posting Permissions

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