Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
33Activity
0 of .
Results for:
No results containing your search query
P. 1
Macros

Macros

Ratings: (0)|Views: 342|Likes:
Published by bharat

More info:

Published by: bharat on Aug 21, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

05/18/2013

pdf

text

original

 
Delete Blank Rows in Excel
Sub DeleteEmptyRows()''This macro will delete all rows, which are missing data in a'particular column, underneath and including the selected cell.'Dim CounterDim i As IntegerCounter = InputBox("Enter the total number of rows to process")ActiveCell.SelectFor i = 1 To CounterIf ActiveCell = "" ThenSelection.EntireRow.DeleteCounter = Counter - 1ElseActiveCell.Offset(1, 0).SelectEnd IfNext iEnd Sub
Delete Empty Columns (Excel 2007)
Sub Delete_Empty_Columns()first = Selection.Columnlast = Selection.Columns(Selection.Columns.Count).ColumnFor i = last To first Step -1If WorksheetFunction.CountBlank(ActiveSheet.Columns(i)) = 1048576ThenColumns(i).DeleteEnd IfNext iEnd Sub
Delete Empty Columns (Previous Versions of Excel)
Sub Delete_Empty_Columns()first = Selection.Columnlast = Selection.Columns(Selection.Columns.Count).Column
 
For i = last To first Step -1If WorksheetFunction.CountBlank(ActiveSheet.Columns(i)) = 65536 ThenColumns(i).DeleteEnd IfNext iEnd Sub
Sort Worksheet Tabs - Ascending or Descending Order 
Sub Sort_Worksheets()Dim i As IntegerDim j As IntegerDim iAnswer As VbMsgBoxResultiAnswer = MsgBox("Sort Sheets in Ascending Order?" & Chr(10) _& "Clicking No will sort in Descending Order", _vbYesNoCancel + vbQuestion + vbDefaultButton1, "Sort Worksheets")For i = 1 To Sheets.CountFor j = 1 To Sheets.Count - 1If iAnswer = vbYes ThenIf UCase$(Sheets(j).Name) > UCase$(Sheets(j + 1).Name) ThenSheets(j).Move After:=Sheets(j + 1)End IfElseIf iAnswer = vbNo ThenIf UCase$(Sheets(j).Name) < UCase$(Sheets(j + 1).Name) ThenSheets(j).Move After:=Sheets(j + 1)End IfEnd IfNext jNext iEnd Sub
Bubble Sort Macro in Excel
Sub bubble_sort()Dim sortingArray As Variant, i As Long, j As Long, temp As VariantsortingArray = Selection.ValueFor i = 1 To (UBound(sortingArray, 1) - 1)For j = i To UBound(sortingArray, 1)If Val(sortingArray(j, 1)) < Val(sortingArray(i, 1)) Thentemp = sortingArray(i, 1)
 
sortingArray(i, 1) = sortingArray(j, 1)sortingArray(j, 1) = tempEnd IfNext jNext iSelection.Value = sortingArrayEnd Sub
Reverse Rows or Columns in a Worksheet
Public Sub Reverse_Rows_or_Columns()'This Macro will reverse a selection of rows or columns.'Note: you cannot select an etire row or column, but one'cell less than that will work fine.'Don't forget to assign this macro a keyboard shortcut or'a toolbar button.Dim Arr() As VariantDim Rng As RangeDim C As RangeDim Rw As LongDim Cl As LongOn Error GoTo EndMacroApplication.ScreenUpdating = FalseApplication.Calculation = xlCalculationManualApplication.EnableEvents = FalseSet Rng = SelectionRw = Selection.Rows.CountCl = Selection.Columns.CountIf Rw > 1 And Cl > 1 ThenMsgBox "Must select either a range of rows or columns, but notsimultaneaously columns and rows.", _vbExclamation, "Reverse Rows or Columns"Exit SubEnd IfIf Rng.Cells.Count = ActiveCell.EntireRow.Cells.Count ThenMsgBox "Can't select an entire row, only up to one cell less than anentire row.", vbExclamation, _"Reverse Rows or Columns"Exit SubEnd IfIf Rng.Cells.Count = ActiveCell.EntireColumn.Cells.Count ThenMsgBox "Can't select an entire column, only up to one cell less than anentire column.", vbExclamation, _"Reverse Rows or Columns"Exit SubEnd If

Activity (33)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
DIMATTEOC liked this
prasaddr liked this
lengvetou liked this
Ferdi Uy liked this
Ashok1981 liked this
nsurani liked this
ramdarkmaster liked this
ehtesham11 liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->