Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
5Activity
0 of .
Results for:
No results containing your search query
P. 1
Create Excel Macro Without Having Programming Knowledge

Create Excel Macro Without Having Programming Knowledge

Ratings:

4.67

(9)
|Views: 1,258 |Likes:
Published by Lony
You can create a MS Excel Macro to boost up your work without having programming knowledge.
You can create a MS Excel Macro to boost up your work without having programming knowledge.

More info:

Published by: Lony on Jan 15, 2009
Copyright:Attribution Non-commercial

Availability:

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

12/16/2012

 
http://sumsulislam.wetpaint.com, anushilony@yahoogroups.com,Please be a member of 
anushilony 
groups of YahooGroups.
S M Sumsul Islam, Sr Training Executive-IT, ACI Limited, 245 Tejgaon I/A, Dhaka -1208. Cell: +8801730028467
 
1.Sub FormattingMacro ()
With Selection.Font.Name = “Arial”.FontStyle = “Bold”.Size = 16.Strikethrough = False.Superscript = False.Subscript = False.OutlineFont = False.Shadow = False.Underline = xlUnderlineStyleNone.ColorIndex = 3End With
 
End Sub2.Sub FormattingMacro()
With Selection.Font.Name = “Arial”.FontStyle = “Bold”.Size = 14.ColorIndex = 3End With
End Sub3.Sub ConvertFormulas()
Selection.CopySelection.PasteSpecial Paste:=xlPasteValues, _ Operation:=xlNone, SkipBlanks:=False, Transpose:=FalseApplication.CutCopyMode = False
End Sub
Tags
Range(“B1:B10”).SelectActiveCell.Offset(0, 1).Range(“A1:A10”).Select
A single statement can be as long as needed. However, you may want to break the statement intotwo or more lines. To do so, insert a space followed by an underscore(_). The following code,although written as two lines, is actually a single VBA statement:
Sheets(“Sheet1”).Range(“B1”).Value = Sheets(“Sheet1”).Range(“A1”).Value
You can insert comments freely into your VBA code. The comment indicator is an apostrophe singlequote character (‘). Any text that follows a single quote is ignored. A comment can be a line by itselfor can be inserted after a statement. The following examples show two comments:‘ Assign the values to the variables
Rate = .085 ‘Rate as of November 16
4.A VBA module consists of procedures. A
procedure
is basically computer codethat performs some action. The following is an example of a simple Sub procedure
 
http://sumsulislam.wetpaint.com, anushilony@yahoogroups.com,Please be a member of 
anushilony 
groups of YahooGroups.
S M Sumsul Islam, Sr Training Executive-IT, ACI Limited, 245 Tejgaon I/A, Dhaka -1208. Cell: +8801730028467
 
called ShowSum (it adds 1 + 1 and displays the result):Sub ShowSum()
Sum = 1 + 1MsgBox “The answer is “ & Sum
End Sub5.Function AddTwo(arg1, arg2)
AddTwo = arg1 + arg2
End Function
Tags
You refer to an object in your VBA code by specifying its position in the object hierarchy, using aperiod as a separator
Application.Workbooks(“Book1”)Application.Workbooks(“Book1”).Worksheets(“Sheet1”)Application.Workbooks(“Book1”).Worksheets(“Sheet1”).Range(“A1”)Worksheets(“Sheet1”).Range(“A1”)Range(“A1”)
 
http://sumsulislam.wetpaint.com, anushilony@yahoogroups.com,Please be a member of 
anushilony 
groups of YahooGroups.
S M Sumsul Islam, Sr Training Executive-IT, ACI Limited, 245 Tejgaon I/A, Dhaka -1208. Cell: +8801730028467
 
You refer to properties by combining the object with the property, separated by a period. Forexample, you can refer to the value in cell A1 on Sheet1 as follows:
Worksheets(“Sheet1”).Range(“A1”).ValueInterest = Worksheets(“Sheet1”).Range(“A1”).ValueWorksheets(“Sheet1”).Range(“A1:C12”).ClearContents
You refer to a property in your VBA code by placing a period and the property name after theobject’s name. For example, the following VBA statement sets the Value property of a range named
Frequency
to 15. (That is, the statement causes the number
15
to appear in the range’s cells.)
Range(“frequency”).Value = 15
 
A Range object also has a Formula property, which is
not
read-only; that is, you can insert a formulainto a cell by changing its Formula property. The following statement inserts a formula into cell A1by changing the cell’s Formula property:
Range(“A1”).Formula = “=SUM(A1:A10)”ActiveCell.RowWorkbooks(“Sales.xls”).Worksheets(“Summary”)Workbooks(1).Worksheets(1)Workbooks(1).Sheets(1)Application.ActiveWorkbook.ActiveSheetActiveWorkbook.ActiveSheetActiveSheetMethods
Objects also have
methods.
You can think of a method as an action taken with an object. For example,Range objects have a Clear method. The following VBA statement clears a Range, an action that isequivalent to selecting the Range and then choosing Edit
?
Clear
?
All:
Range(“A1:C12”).Clearrate = Worksheets(“Sheet1”).Range(“A1”).Value
6.Sub CheckCell()
If ActiveCell.Value < 0 Then ActiveCell.Font.ColorIndex = 3
End Sub7.Sub SumSquared()
Total = 0For Num = 1 To 10Total = Total + (Num ^ 2)Next NumMsgBox Total
End Sub8.Sub AlignCells()
With Selection.HorizontalAlignment = xlCenter.VerticalAlignment = xlCenter.WrapText = False

Activity (5)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
BSASciti liked this
plancoster liked this
zamrisamz liked this

You're Reading a Free Preview

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