assign values to specific cells in an excel sheet through text file

S

s_pushparaj

Hi list
I am very new to macros or any visual basic codes. Kindly guide me with
materials or ideas to assign values to specific cells in an excel sheet.
For example,
I wish to assign values 1,2,3,4.... into A1, B1, C1, D1...... in Sheet1
of C:\data.xls.
with thanks
pushparaj
 
G

Gary''s Student

Here is an example:

Sub Macro1()
ChDir "C:\"
Workbooks.Open Filename:="C:\data.xls"
Range("A1").Value = 1
Range("B1").Value = 2
Range("C1").Value = 3
Range("D1").Value = 4
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top