Wednesday, August 19, 2009

SOME IMPORTANT EXCEL MACROS

How To Enable Macros.

Click Tools > Macro > Security. 2. Select Medium Security and click OK. Close the document and open it again.

**********************************************
TO DELETE EVERY OTHER ROW:
********************************************

in an unused column enter 1, x, 2, x in the first 4 rows, then use the fill handle as far down as necessary. The series will repeat, 3, x, 4, x, etc. Sort everything by this column and all the x's will be together. You can delete all these rows, then clear the column

To delete every other row:

Code:
Option Explicit

Sub Test()

Dim x As Long
Dim LastRow As Long

LastRow = Range("A65536").End(xlUp).Row
For x = LastRow To 1 Step -2
Rows(x & ":" & x).Delete
Next x

End Sub
*******************************************************
To delete sheets from a workbook without the user being prompted for any
confirmations you can use this macro:
********************************************************
Sub DeleteSheet(strSheetName As String)
' deletes a sheet named strSheetName in the active workbook
Application.DisplayAlerts = False
Sheets(strSheetName).Delete
Application.DisplayAlerts = True
End Sub
**********************************************************
CLICK HERE FOR SOURCE
A method that find a value in colume A then replace all the duplicate values in colume B.

its simple find and replace method but i want to replace multiple values at the same time . i dont want to write find and replace values every time.
just in one go it change all the values

Sub caps()
Worksheets("Sheet1").Columns("A").Replace _
What:="england", Replacement:="England", _
SearchOrder:=xlByColumns, MatchCase:=True
End Sub

No comments:

Post a Comment