Back to Excel Newsletter Archives

OzGrid Excel and VBA Newsletter February 2007

Add to GoogleSearch Tips Excel Data Manipulation and Analysis

Excel Newsletter Index

Ozgrid Updates | EXCEL TIPS AND TRICKS | EXCEL VBA TIPS AND TRICKS

Complete Excel Training Course Special!
We don't teach Excel from a manual, we teach Excel from experience!
Free Help Forum, not just Excel!

Excel Trader Package : Technical Analysis in Microsoft Excel. 146 technical indicators and experts for technical analysis. Free download real and historical stock quotes from USA, Europe, and Canada into Excel spreadsheets. Mutual funds, corporate bonds, Major USA Market Indices, Major World Indices are downloadable into Microsoft Excel spreadsheets. Daily, weekly and monthly quotes into one Excel spreadsheets. Quotes refresh. The best way to Start technical Analysis for the beginner

Finance Templates Gold Edition: All at 80% off and a 30 day money back guarantee! PLUS a bonus pack of 30 extra FREE financial templates

OzGrid Updates

We are currently spending countless hours updating our website.  We have made a huge effort to standardize all web pages, get rid of all superfluous HTML code, which will increase the download speed of pages.  This is a “work in progress”, which we hope to finish over the next few months.  We invite all our readers to check out the “new look” and give us any comments on messy pages.

Both the Excel tips and the Excel VBA tips are contributed by Andy Pope (Microsoft MVP, Ozgrid MVP, Regular Forum Poster andOzgrid's Prime developer) . Andy runs and maintains and excellent content rich site .

EXCEL TIPS AND TRICKS

Got any Excel Questions? Free Excel Help

Dotted line for future data

The line is actually to data series with the 2nd line formatted with the line style dashed.

.

The line for actual data is solid whilst future data is display with a dashed line

Select the range A1:C10 and create a normal Line chart.

Format both series lines to give you the solid and dashed line styles. To make sure the lines appear as one the first Future data point should be the same value as the last Actual data point.

  A B C
1   Actual Future
2 2002 0.273966  
3 2003 0.126777  
4 2004 0.584197 0.584197
5 2005   0.898247
6 2006   0.560888
7 2007   0.144713
8 2008   0.632703
9 2009   0.604576
10 2010   0.779904

Excel Dashboard Reports & Excel Dashboard Charts Half Price & Money Back

EXCEL VBA TIPS AND TRICKS

Advertisements

Resize userform

The code below will add a control to the user form which will allow you to resize the form by dragging the resize handle. No complex APIs required just some code in the Mouse events of the control.

Option Explicit

Private Const MResizer = "ResizeGrab"
Private WithEvents m_objResizer As MSForms.Label
Private m_sngLeftResizePos As Single
Private 
m_sngTopResizePos As Single
Private 
m_blnResizing As Single

Private Sub m_AddResizer()
'
' add resizing control to bottom right hand corner of userform
'
    Set m_objResizer = Me.Controls.Add("Forms.label.1", MResizer, True)
    
With m_objResizer
        
With .Font
            .Name = "Marlett"
            .Charset = 2
            .Size = 14
            .Bold = 
True
        End With
        .BackStyle = fmBackStyleTransparent
        .AutoSize = 
True
        .BorderStyle = fmBorderStyleNone
        .Caption = "o"
        .MousePointer = fmMousePointerSizeNWSE
        .ForeColor = RGB(100, 100, 100)
        .ZOrder
        .Top = Me.InsideHeight - .Height
        .Left = Me.InsideWidth - .Width
    
End With
    
End Sub
Private Sub 
CommandButton1_Click()
    
Unload Me
End Sub
Private Sub 
m_objResizer_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal As Single, ByVal As Single)

    
If Button = 1 Then
        m_sngLeftResizePos = X
        m_sngTopResizePos = Y
        m_blnResizing = 
True
    End If
    
End Sub
Private Sub 
m_objResizer_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal As Single, ByVal As Single)

    
If Button = 1 Then
        With m_objResizer
            .Move .Left + X - m_sngLeftResizePos, .Top + Y - m_sngTopResizePos
            Me.Width = Me.Width + X - m_sngLeftResizePos
            Me.Height = Me.Height + Y - m_sngTopResizePos

' 27-May-2006 Addition of code to make sure sizing handle remains fixed in the bottom right hand corner
            .Left = Me.InsideWidth - .Width
            .Top = Me.InsideHeight - .Height
        
End With
    End If
    
End Sub
Private Sub 
m_objResizer_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal As Single, ByVal As Single)
    
If Button = 1 Then
        m_blnResizing = False
    End If
End Sub
Private Sub 
UserForm_Initialize()

    m_AddResizer
    
End Sub
Private Sub 
UserForm_Terminate()

    Me.Controls.Remove MResizer
    
End Sub

Thanks to László Balogh for pointing out the floating sizing handle bug.

Download Example Got any Excel Questions? Free Excel Help .

Until next month, keep excelling!

Got any Excel Questions? Free Excel Help

Complete Excel Training Course Special!
We don't teach Excel from a manual, we teach Excel from experience!
Free Help Forum, not just Excel!

Instant Download and Money Back Guarantee on Most Software

Add to Google Search Tips

Excel Trader Package Technical Analysis in Excel With $139.00 of FREE software!

Excel Data Manipulation and Analysis

Microsoft ® and Microsoft Excel ® are registered trademarks of Microsoft Corporation. OzGrid is in no way associated with Microsoft

FREE Excel Help