Search This Blog
Monday, 30 July 2012
CREATE IN-CELL BAR CHART IN EXCEL 2007 USING FORMULA- TYPE 1
Formula in F2 to F6:
=REPT("█",A2)&CHAR(10)&REPT("█",B2)&CHAR(10)&REPT("█",C2)&CHAR(10)&REPT("█",D2)&CHAR(10)&REPT("█",E2)
Formatting:
1. Change font size to 3.
2. Wrap Text
3. Go to Format Cells and click on Alignment Tab and Orientation to 90 Degree
4. Select the font color.
AND YOUR INCELL BAR GRAPH IS READY
To see Type 2, Click on
http://excelvbatipsforbeginners.blogspot.in/2012/08/create-in-cell-bar-chart-in-excel-2007.html
Did it help you? Please post your valuable comment. Thanks!!
CREATE AN INDEX FOR YOUR WORKBOOK
Paste the below code in the module and run it
Sub create_index()
Dim i As Integer
Dim newsheet
Dim j As Integer
Set newsheet = Worksheets.Add(before:=Sheets(1))
With newsheet
.Name = "Index"
With Range("A1:H1")
.Merge
.Value = "INDEX"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Font.Bold = True
.Font.Color = vbRed
.Font.Size = 13
End With
j = 2
For i = 2 To ThisWorkbook.Sheets.Count
.Range("A" & j) = Sheets(i).Name
.Range("A" & j).Select
.Hyperlinks.Add Anchor:=Selection, _
Address:="", SubAddress:="" & Sheets(i).Name & "!A1"
j = j + 1
Next
ActiveWindow.DisplayGridlines = False
End With
End Sub
Sub create_index()
Dim i As Integer
Dim newsheet
Dim j As Integer
Set newsheet = Worksheets.Add(before:=Sheets(1))
With newsheet
.Name = "Index"
With Range("A1:H1")
.Merge
.Value = "INDEX"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Font.Bold = True
.Font.Color = vbRed
.Font.Size = 13
End With
j = 2
For i = 2 To ThisWorkbook.Sheets.Count
.Range("A" & j) = Sheets(i).Name
.Range("A" & j).Select
.Hyperlinks.Add Anchor:=Selection, _
Address:="", SubAddress:="" & Sheets(i).Name & "!A1"
j = j + 1
Next
ActiveWindow.DisplayGridlines = False
End With
End Sub
This code will insert a sheet in workbook named "Index". This sheet will have list of name of all sheets with hyperlink. You can move to any sheet directly by clicking on it's name.
Thursday, 26 July 2012
DELETE ALL SHAPES IN YOUR WORKSHEET
Paste below code in module and run it
Sub delete_shapes()
Dim i As Integer
For i = ActiveSheet.Shapes.Count To 1 Step -1
ActiveSheet.Shapes(i).Delete
Next
End Sub
Monday, 23 July 2012
CREATE DATA VALIDATION LIST WITH UNIQUE VALUES FROM A LIST OF DUPLICATES
Paste the below code in module and run it.
Option Explicit
Sub data_validation_with_unique_values()
Dim clctn As New Collection
Dim arr As Variant
Dim i As Integer
Dim distinct() As String
'Fill values from your range into array
arr = Application.Transpose(Sheet1.Cells(1, 1).CurrentRegion.Resize(, 1).Value)
'Create a list of unique
On Error Resume Next
For i = LBound(arr) To UBound(arr)
clctn.Add arr(i), arr(i)
Next i
On Error GoTo 0
ReDim distinct(1 To clctn.Count)
For i = 1 To clctn.Count
distinct(i) = clctn(i)
Next
'Paste unique values in column E
Sheet1.Cells(1, 5).Resize(clctn.Count).Value = Application.Transpose(distinct)
'Give a name range to your list in column E
Range("E1:E" & Range("E65536").End(xlUp).Row).Name = "Myrange"
'Create data validation list in active cell using named range
ActiveCell.Validation.Add xlValidateList, xlValidAlertStop, xlBetween, "=Myrange"
End Sub
Note: Change the highlighted part as per your requirement.
Option Explicit
Sub data_validation_with_unique_values()
Dim clctn As New Collection
Dim arr As Variant
Dim i As Integer
Dim distinct() As String
'Fill values from your range into array
arr = Application.Transpose(Sheet1.Cells(1, 1).CurrentRegion.Resize(, 1).Value)
'Create a list of unique
On Error Resume Next
For i = LBound(arr) To UBound(arr)
clctn.Add arr(i), arr(i)
Next i
On Error GoTo 0
ReDim distinct(1 To clctn.Count)
For i = 1 To clctn.Count
distinct(i) = clctn(i)
Next
'Paste unique values in column E
Sheet1.Cells(1, 5).Resize(clctn.Count).Value = Application.Transpose(distinct)
'Give a name range to your list in column E
Range("E1:E" & Range("E65536").End(xlUp).Row).Name = "Myrange"
'Create data validation list in active cell using named range
ActiveCell.Validation.Add xlValidateList, xlValidAlertStop, xlBetween, "=Myrange"
End Sub
Note: Change the highlighted part as per your requirement.
Sunday, 22 July 2012
QUICK TIP TO REMOVE "0" FROM ACTIVE WORKSHEET
Click on Office Button
Select Excel Options
Go to Advanced and deselect the checkbox "Show a zero in cells that have zero value as shown in the below figure.(Click on the image to enlarge it)
It will remove all the zero from your worksheet.
Select Excel Options
Go to Advanced and deselect the checkbox "Show a zero in cells that have zero value as shown in the below figure.(Click on the image to enlarge it)
It will remove all the zero from your worksheet.
Friday, 20 July 2012
CLOSE USERFORM ON ESCAPE KEY
Put a commandbutton on your userform and write the below code on command button Click event.
Private Sub CommandButton1_Click()
Unload Me
End Sub
Then set cancel to true in its property. See image below(Click on the image to enlarge it)
Now when you run userform and press escape key on your keyboard, userfrom will be closed.
Is the post useful? Please post your comment and follow my blog:)
Is the post useful? Please post your comment and follow my blog:)
PASTE NON BLANK CELLS ONLY USING EXCEL
Array Formula in B1:
=LOOKUP("zzzzz",CHOOSE({1,2},"",INDEX(A:A,SMALL(IF($A$1:$A$10<>"",ROW($A$1:$A$10)),ROWS($B$1:B1)))))
Press Ctrl+Shift+Enter and drag it down to B10.
Tip: This is also useful when you create a data validation list from a range with blank cells in it. In that case you can create a new range with non-blank cells using above formula and then use this new range for data validation.
Subscribe to:
Posts (Atom)





