Thursday, 25 July 2013

How To Call .Xla Functions In To .Xlsm Excel File

Here I describe about call a  function from .xla  file in to .xlsm file.I explain it step by step
with pictures, let's see-
1)Open excel sheet and save with 'FileName.xla' extension (here i give 'Functions.xla' )
    and insert  a module then write  a simple 'Add' function.
2)Open another excel sheet and save it with 'FileName.xlsm' extension(here as a 'TesttFunction.xlsm')
   insert a button with assign a micro.
3)Assign the micro to button and write this code and see highlighted box,here we call the 'Add'
    from 'Functions.xla' file.
4)Save the both files in same folder/directory.

5)And click the button ,result will appear.

Excel Range Name With Spaces And Ampersand

I discuss about excel range name with spaces and ampersand, when  we create a list and
save the rang name it replace the space or other special  character with underscore("_") ,
it can not save with space and ampersand. Just see Microsoft link.
1)If range name  is  "My range" it save as  "My_range".
2)If range name  is  "My&range" it save as  "My_range".



Wednesday, 24 July 2013

Create A Drop Down List Of Micros In Excel(VBA)

We can  create a drop down list of micros in excel.But here is some rules  we should  know-
1)First you create a list name of micros and make a  drop down list of it.
2)Then you create a micros.
                              I am upload a video for simply create a drop down list of micros-

Create A Simple Dependent Drop Down List In Excel

Here we learn how to create a simple drop down list in excel.But firstly we know
that how to create a drop down list. I am  upload the videos for both process
please see these video and try to do same.
    Create A Simple Drop Down List In Excel   

      Create A Dependent Drop Down List In Excel
              

Looping Through Files In A Directory(VBA)


When we want go through the files, located in directory, then we need loop in side the directory.
Below i write a  sample code for the same(Blue color text is main loop go to through the file in folder)-

    Dim fso As Object
    Set fso = CreateObject("Scripting.FileSystemObject")
    Dim objFolder
    Set objFolder = fso.GetFolder("C:\ForSample")       
    Dim i As Integer: i = 1
    Dim FileName As Variant
    Dim LineText As String
    Dim str As String
    Dim objFile
    For Each objFile In objFolder.files
        str = ""
         FileName = objFile
         Open FileName For Input As #50
         While Not EOF(50)
            Line Input #50, LineText
            str = str & LineText
         Wend       
        Close #50
    Next


Sunday, 21 July 2013

Difference Between Xla And Xalm AddIns

There is compatibility in old version and new version of VS. We not use micros features 
with this extension .Both are Add-In Files. The main difference is that XLAM cannot be opened 
in earlier office versions (Pre 2007). And hence when you are creating Add-Ins which has 
to be compatible with earlier versions then always create an XLA instead of XLAM. – 

Whenever we save  the excel sheet, we choose the required extension according enabling micros or 
other features.But in case of .xla and .xlam file is not work in MsOffice 2010, let's do for test:-
1) I take a 2010 MS Office and Open excel.
2) Create a micro in excel sheet and save it with .xla extension and other sheet with .xlam.
3) When you open the files the whole worksheet is disable.
4) Because of these extension is uses for earlier version like 2003. They not work in ms office 2010.

Create A Graph For Data In Excel Worksheet.

Here We Learn To Create A Simple Graph In Excel Worksheet:-

This Can Be Achieve In Some Steps:-
1)Open the Ms_excel.
2)Prepare the data which is required ,in two columns for with respect to X-axis and Y-axis.
3)After the data entry ,go to 'Insert Tab' and select 'Line' as shown in picture.                                                          
                
4)The new dialog box is appear ,Just delete it's lines and texts for entering your new lines (for
   data ) and text.
5)After that go to 'Design' Tab (It appear after select 'Line'), select 'Select Data'.
6)Open a new Dialog box.Where we select the data for X-axis(Horizontal) and Y-axis(Vertical).
                       
7)Select the data from columns. Here Above red line is for Vertical data and below is for 
   horizontal data, blue circle is input data.For Horizontal click 'Edit' open a new dialog box,Enter the 
   range in text box and click on 'Ok'.
8)Your graph is prepared-





Copy Text File In WorkSheet And Some Important Query On Vba Programming.

Here i write a some queries and code which  is generaly use in vba program:-

Copy Text File In Worksheet :-
We create  a  module for this process and give the address of file where  it is locate.
Just see the below code and try it.

Sub GetDataFromTextFiles()
 Dim fso As Object
    Set fso = CreateObject("Scripting.FileSystemObject")
    Dim objFolder
    Set objFolder = fso.GetFolder("C:\ForSample")       
    Dim i As Integer: i = 1
    Dim FileName As Variant
    Dim LineText As String
    Dim str As String
    Dim objFile
    For Each objFile In objFolder.files
        str = ""
         FileName = objFile
         Open FileName For Input As #50
         While Not EOF(50)
            Line Input #50, LineText
            str = str & LineText
         Wend
        ActiveSheet.Cells(i, 1).Value = str
        i = i + 1
        Close #50
    Next
End Sub



Copy the data   from to sheet to anther in workbook :-
1) Sheets(SheetName1).Range(A1,D2).Value = Sheets(SheetName2).Range(A1,D2).Value
2) Sheets(SheetName1).Cells(row,col).Value = Sheets(SheetName2).Cells(row,col).Value

How to call a Excel functions in Vba:-
Here 'd'  ,'c' and 'e' as integer and we write this code inside the Vba module-

 d = Application.WorksheetFunction.Power(d1, 0.5)
 e = Application.WorksheetFunction.Power((c * d), 0.25)
Note- The power function is not accept the negative(-ve) values.