Access Excel Worksheet Cells Using VBA

How to Access Excel Worksheet Cells with a Macro Using the Range Property
Before you can start performing calculations with your Excel data, you obviously have to enter data into the worksheet. Now if you wish to enter data with the help of a macro you need to know how to access a worksheet cell like A1 or a range of cells like A1:C1. The ‘range’ property helps you to access a single cell or a range of cells. Later you can define whether a cell can contain text, number, currency, formulas or functions.

  • Click on the ‘Developer’ Tab
  • From the ‘Code’ group select Visual Basic
  • The Microsoft Visual Basic window pops up
  • Click on ‘Insert’ and select ‘Module’.
  • In the white workspace area type ‘Sub macroname()’. Select a macro-name that is short and easy to remember and describes well what the macro will do
  • Press enter and you will notice that the application automatically adds ‘End Sub’
  • Between the ‘Sub macroname ()’ and the ‘End Sub’ you will write the code that will execute what the macro is supposed to do

We enter the following code for example:
Sub range_propert_to_access_worksheet_cells()
Range(“A3”) = “Name”
Range(“B3”) = “Salary”
End Sub

When we click on the run arrow-like button (>) the macro executes the code and after minimizing the MS-Visual Basic Window we can observe that the text ‘Name’ and ‘Salary’ have been placed in the appropriate worksheet cells ‘A1’ and ‘B1’.
Let’s have a look at the MS Excel VBA training video.


12 thoughts on “Access Excel Worksheet Cells Using VBA

  1. mani

    sir i have one question i want pull data from i.e into excel through filter table date enter in excel sheet and run is it possible to do such task in excel vba….

    Reply
    1. Helene

      dit :Le partie Nazi c’est présenter comme un partie de travailleur, naasnotl-socialiite, amis des syndicats et tous.Mais après qu’il ai pris le pouvoir il a organisé une fête avec les syndicats pour les remercier et en a profiter pour tous les mettre en prison.Comme les communistes…

      Reply
    2. http://netcheck.tech/commissionsoup.com

      This is what “ING” has come to?!…. Flame is freaking right now. If that isn’t the epitome of Hipster, beanie, skinny jean wearing fashionistas. Where was Kolohe? Has “ING” hung its hat on Dion or what? Some good photos by Jimmy Wilson but this has the look of Chas Smith all over it. Is GLOBE still in business and what do they sell? Shoes and retro-70′s skateboards in 80′s neon colors. This looks like a really mixed message.

      Reply
  2. Kuldeep Dwivedi

    How can I enable macro for a excel sheet, because I’ve created a macro, to click run, it displays a message box indication for enable to macro for this excel sheet.

    Reply
  3. Pingback: Best Training on Advanced Excel and VBA in Bangalore | jaseemblog

  4. ankit

    I am a professor of finance. I am Chartered Fin. Analyst as well as FInancial Risk Manager.

    I want to purchase the DVDs of your videos for VBA and excel.

    Can you give me your mobile number?

    Reply
  5. Vikash Roy

    Dear Sir,
    First of all thank you so much for your patience to describe so easily. You are a great person to help with such great effort. I am a guy with willing and keen to learn so i keep searching on internet. Infact i saw you video, that solved most of my search. I have a query kindly explain how to solve it.

    I want to create a form which will save data in sheet 2 but macro button should display in sheet 1. If i click on macro button it should open in sheet 1 and after filling data it should go to sheet 2 worksheet.
    Though i have created the form which is easy to open in sheet 2, however whenever i want to connect with sheet 1 not able to do so.
    please guide me….

    Thank you

    Vikash ROy

    Reply
    1. Isabelle

      Felices vacaciones Fede!!! A preparase muy bien para el 20332#8&10;. Urgente un psicólogo, un buen preparador físico (empezó muy lento físicamente el 2012, y lo terminó de la misma manera), un buen entrenador, un buen programa de partidos.

      Reply
  6. ashu

    Dear Sir,

    I have create excel sheet for Computer Management. My first sheet is Computer course content and second sheet is student data. so i have entered data in sheet second then it show me a simple design form so how can make. so please help me..

    thanks & regards,
    Ashu

    Reply
    1. Dorothy

      En los términos más llanos: es imposible una literatura que sin la postura política que nombra Lola (cómo ella misma dice) siga explorando todas sus pobsiilidades. Ignorar dicha postura, que preferiría llamar perspectiva, equivale a negarnos parte de esa literatura; en términos visuales, seria negarnos a ver la pintura completa, quedarnos en un solo nivel.Para que existan escritores ambiciosos, como Panero (ambicioso en el mejor sentido) también deben existir lectores de esa misma naturaleza.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *