Shiv, Are you not using Excel help? or are you reading a book and trying to understand it? Or are you in school and this is your homework?
Option Explicit Statement Used at module level to force explicit declaration of all variables in that module. Syntax Option Explicit Remarks If used, the Option Explicit statement must appear in a module before any procedures. When Option Explicit appears in a module, you must explicitly declare all variables using the Dim, Private, Public, ReDim, or Static statements. If you attempt to use an undeclared variable name, an error occurs at compile time. If you don't use the Option Explicit statement, all undeclared variables are of Variant type unless the default type is otherwise specified with a Deftype statement. Note Use Option Explicit to avoid incorrectly typing the name of an existing variable or to avoid confusion in code where the scope of the variable is not clear. -------------------- Application.InputBox Method Displays a dialog box for user input. Returns the information entered in the dialog box. expression.InputBox(Prompt, Title, Default, Left, Top, HelpFile, HelpContextID, Type) -------------------------------------------- UCase Function Returns a Variant (String) containing the specified string, converted to uppercase. Syntax UCase(string) The required string argument is any valid string expression. If string contains Null, Null is returned. Remarks Only lowercase letters are converted to uppercase; all uppercase letters and nonletter characters remain unchanged. so: MonthOfSales = InputBox(prompt:= "Enter month of sales", title:= "Month") prompts the user to enter a "month" and stores it in the variable "MonthOfSales" then: Range("A1").Value = UCase(MonthOfSales) converts "MonthOfSales" to uppercase and puts it in Cell A1. P ________________________________ From: Shiv Goel <shivyn...@gmail.com> To: excel-macros@googlegroups.com Sent: Thu, February 11, 2010 2:34:06 AM Subject: $$Excel-Macros$$ VBA Help Option Explicit Sub InputSales() Dim MonthOfSales As String Dim SalesData(1 to 4) MonthOfSales = InputBox(prompt:= "Enter month of sales", _ title:= "Month") SalesData(1) =InputBox(prompt:= "Enter sales for week 1") SalesData(2) =InputBox(prompt:= "Enter sales for week 2") SalesData(3) =InputBox(prompt:= "Enter sales for week 3") SalesData(4) =InputBox(prompt:= "Enter sales for week 4") Range("A1").Value = UCase(MonthOfSales) Range("B2:E2").Cells(1).Value = SalesData(1) Range("B2:E2").Cells(2).Value = SalesData(2) Range("B2:E2").Cells(3).Value = SalesData(3) Range("B2:E2").Cells(4).Value = SalesData(4) Range("B2:E2").NumberFormat = "£0.00" Columns("A:E").EntireColumn.AutoFit End Sub Can any body help me out to crack this code 1. Why they use Option Explicit 2. What is the meaning of this code Range("A1").Value = UCase(MonthOfSales) 3. What is the meaning of this codeMonthOfSales = InputBox(prompt:= "Enter month of sales", _ title:= "Month") -- Shiv Goel 8NBYN060 ICFAI National College,YNR 9416275776 -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 6,700 subscribers worldwide and receive many nice notes about the learning and support from the group.Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 6,700 subscribers worldwide and receive many nice notes about the learning and support from the group.Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe