Description:

In the previous post we have seen, how to read data from excel to VBA. We will see how to write data to Worksheet Cell in Excel VBA.

Write Data to Worksheet Cell in Excel VBA – Solution(s):

Delete Worksheet in Excel VBA It is same as reading the data from Excel to VBA. We can use Cell or Range Object to write into a Cell.

Write Data to Worksheet Cell in Excel VBA – An Example of using Cell Object

The following example will show you how to write the data to Worksheet Cell using Cell Object.

Example Codes

In this example I am writing the data to first Cell of the Worksheet.

Sub sbWriteIntoCellData()

Cells(1, 1)="Hello World"
'Here the first value is Row Value and the second one is column value 
'Cells(1, 1) means first row first column
End Sub

In this example I am writing the data to first row and fourth column of the worksheet.

Sub sbWriteIntoCellData1()

Cells(1, 4)="Hello World"

End Sub

Write Data to Worksheet Cell in Excel VBA – An Example of using Range Object

The following example will show you how to write the data into Worksheet Cell or Range using Range Object.

Example Codes

In this example I am reading the data from first Cell of the worksheet.

Sub sbRangeData()

Range("A1")="Hello World"
'Here you have to specify the Cell Name which you want to read - A is the Column and 1 is the Row

End Sub

Write Data to Worksheet Cell in Excel VBA – Specifying the Parent Objects

When you are writing the data using Cell or Range object, it will write the data into Active Sheet. If you want to write the data to another sheet, you have to mention the sheet name while writing the data.

The below example is reading the data from Range A5 of Sheet2:

Sub sbRangeData1()

Sheets("Sheet2").Range("A5")="Hello World"
'Here the left side part is sheets to refer and the right side part is the range to read.

End Sub

In the same way you can mention the workbook name, if you are writing the data to different workbooks.

Premium Project Management Templates

50+ Professional Project Management Templates!

A Powerful & Multi-purpose Templates for project management. Now seamlessly manage your projects, tasks, meetings, presentations, teams, customers, stakeholders and time. This page describes all the amazing new features and options that come with our premium templates.

PREMIUM TEMPLATES
LIMITED TIME OFFER
ON SALE80% OFF
BROWSE ALL TEMPLATES

50+ Project Management Templates Pack

Excel PowerPoint Word

VIEW DETAILS

Ultimate Project Management Template – Advanced

Excel Template

VIEW DETAILS

ULTIMATE PROJECT MANAGEMENT TEMPLATE

Excel Template

VIEW DETAILS

20+ Excel Project Management Pack

Excel Templates

VIEW DETAILS

20+ PowerPoint Project Management Pack

PowerPoint Templates

VIEW DETAILS

10+ MS Word Project Management Pack

Word Templates

VIEW DETAILS

By Published On: May 15th, 2013Categories: Excel VBATags:

Share This Story, Choose Your Platform!

About the Author: Valli

Excel VBA Developer having around 8 years of experience in using Excel and VBA for automating the daily tasks, reports generation and dashboards preparation. Valli is sharing to helps us automating daily tasks.

29 Comments

  1. Tamil February 4, 2015 at 4:42 PM

    Hi Madam,

    the way of tutor is awesome for Beginners. Thanks a lot

    Edward Tamil

  2. Waris March 27, 2015 at 11:09 AM

    Hi Team,

    I am just starting learning ABC of VBA macro, I hope it is very useful site for such learner like me….

    Keep it…

    Waris

  3. JAVAID IQBAL June 8, 2015 at 4:39 AM

    Hi Madam,
    the way of tutor is awesome for Beginners.

    Thanks a lot

  4. JAVAID IQBAL June 8, 2015 at 4:40 AM

    Hi Madam,

    Awesome for Beginners.

    Thanks a lot

  5. Ekram July 31, 2015 at 2:20 AM

    I have been trying to learn Macro for sometime. And this is the first site that has been very helpful. I would definitely recommend this site for anyone to understand what to command and how. We need more ppl like you. Thank you for being such a awesome person.

  6. Yogesh Kumar August 30, 2015 at 6:53 PM

    Hi,

    I am wondering for a VBA code to read entire data from active excel sheet and print line by line in immediate window.
    I searched a lot but unfortunately I did not get any code. Can you help me ? Thanks in advance…

    Yogi