Tuesday, September 10, 2013

Excel & Outlook

Good link to learn how Excel macro can be used along with Outlook:

Sunday, September 8, 2013

Progress bar in excel

Refer to the following link for including progress bar in your VBA code:

Saturday, September 7, 2013

Get the weekday in Excel

Use the below formula to get the weekday.

=TEXT(WEEKDAY(NOW()),"dddd")

Thursday, September 5, 2013

Code to go to the top cell

VBA Code to go to the top cell in a sheet:

Private Sub Workbook_Open()

With ActiveWindow

.ScrollRow = 1

.ScrollColumn = 1

Call Cells(.ScrollRow, .ScrollColumn).Select

End With
End Sub

Tuesday, September 3, 2013

Get to last row in a column

How to get to the last row in a column using VBA:

Dim LastRow As Long
LastRow = Range("I" & Rows.Count).End(xlUp).Row

'I is the column and LastRow is a variable

Delete rows using Loop

VBA code to loop thru rows within column and delete rows containing a certain value:

Dim LastRow As Long 
Dim I As Long 
 
LastRow = Range("D" & Rows.Count).End(xlUp).Row 
 
For I = LastRow To 2 Step -1  'Change the row number
    Set rng = Range("D" & I) 
    If rng.Value= "ABC" Then   'Change the condition
        rng.EntireRow.Delete 
    End If 
     
Next I 

Monday, September 2, 2013

Negative closest value to zero:

Get the negative closest value to zero: