Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I, too, am just starting on C++ add-ins. I have Excel 2003 and MSFT C++
Express Beta. Is that enough to get the job done? In terms of functionality, this might be available already in Excel. But, I wrote it in vb anyway. ConnectTheDots returns a straight line across N number of cells in the form of an array between start and end points. It delivers a trend line; ignoring underlying midpoint values. The output array (line) and input array (underlying data) are then displayed on a chart. Function ConnectTheDots(aRng As Range) 'Assume range1 is a single column _ Or a single row _ If it is multi-dimensional, error _ If it is a single cell, return zero _ If either the first cell or last cell aren't numeric, error Dim myTarg As Range, _ SrcList, Rslt(), _ i As Long, k As Long, step As Double Application.Volatile SrcList = aRng.Value Set myTarg = Application.Caller With myTarg If .Areas.Count 1 Then ConnectTheDots = _ "Function can be used only in a single contiguous range" Exit Function '<<<<< End If If .Rows.Count 1 And .Columns.Count 1 Then ConnectTheDots = _ "Selected cells must be in a single row or column" Exit Function '<<<<< End If If .Cells.Count aRng.Cells.Count Then ConnectTheDots = _ "Input and Output Ranges must be the same size" Exit Function '<<<<< End If If .Cells.Count < aRng.Cells.Count Then ConnectTheDots = _ "Input and Output Ranges must be the same size" Exit Function '<<<<< End If ReDim Rslt(1 To IIf(.Rows.Count 1, .Rows.Count, .Columns.Count)) End With 'Calculate step-value for making intermediate numbers k = UBound(SrcList, 1) i = LBound(SrcList, 1) step = SrcList(i, 1) - SrcList(k, 1) step = (step / (k - 1) * -1) Rslt(1) = SrcList(1, 1) 'First cell value copied Rslt(k) = SrcList(k, 1) ' Last cell value copied k = 1 For i = 2 To (UBound(Rslt) - 1) 'Step value applied to cells 2 - n Rslt(i) = Rslt(k) + step k = i Next i If myTarg.Rows.Count 1 Then ConnectTheDots = Application.WorksheetFunction.Transpose(Rslt) Else ConnectTheDots = Rslt End If End Function input and output: 41.86 41.86 43.41 39.67 55.13 37.47 46.56 35.27 42.46 33.08 36.47 30.88 33.70 28.68 42.84 26.49 46.86 24.29 22.80 22.09 29.19 19.90 17.70 17.70 "Fredrik Wahlgren" wrote: Hi I'm interested in knowing what worksheet functions and commands you feel are missing in Excel. I have noticed that many people have mede various VBA functions and commands available that are very useful depending on your needs. Some of them should perhaps be incorporated in Excel in the future. one thing that I feel is mssing is documentation on making excel add-ins on the Mac using acompile language like C. One of ther reasons I'm asking this is because I'm now learning to make automation add-ins in C++. /Fredrik |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Combo Box in Excel 2oo3, functions missing! | Excel Worksheet Functions | |||
Missing VBA Project References for non-VBA commands | Excel Discussion (Misc queries) | |||
Missing Excel commands | Excel Worksheet Functions | |||
missing mouse functions in Excel xp | Setting up and Configuration of Excel | |||
Missing "Save" and "Save As" functions | Excel Discussion (Misc queries) |