Wednesday, July 6, 2011

Show the positive values with up Arrow and Negative values with Down Arrow

if you want to show the positive values with up arrow and negative values with down arrow. Snapshot below




Here is the code-

Sub up_down_arrow()
Dim i As Long

For i = 2 To Sheets(1).Range("a65356").End(xlUp).Row

' why i have taken p and q in values and font name Wingdings 3 plz check the table in attached workbook

If Sheets(1).Range("a" & i).Value > 0 Then
Sheets(1).Range("b" & i).Value = "p"
Sheets(1).Range("b" & i).HorizontalAlignment = xlCenter

Sheets(1).Range("b" & i).Font.Name = "Wingdings 3"
Sheets(1).Range("b" & i).Font.Color = vbGreen
ElseIf Sheets(1).Range("a" & i).Value <> "" Then

Sheets(1).Range("b" & i).Value = "q"
Sheets(1).Range("b" & i).Font.Name = "Wingdings 3"
Sheets(1).Range("b" & i).Font.Color = vbRed
Sheets(1).Range("b" & i).HorizontalAlignment = xlCenter
End If
Next i

End Sub


Excel Macro File

http://www.filefactory.com/file/cc35d0f/n/diplay_postive_and_negative_values_with_symbols.xlsm

No comments:

Post a Comment

Import data from SQL

Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...