Visual Basic and Excel

Status
Not open for further replies.

asahin11

Member level 3
Joined
Jun 20, 2005
Messages
57
Helped
3
Reputation
6
Reaction score
0
Trophy points
1,286
Activity points
1,767
Hi all,

How can i write data to any cell in an excel document and change name of a sheet? If you recommend me a site or toturial, i will satisfy.

thanks in advance,
 

I am not entirely sure what you are trying to do. However let me try to answer as I understand your question.

You first need to be able to change the sheet name in VB. The simplest way to find out how to do this is to start the macro record, change the sheet name, and then stop the macro. When you go into VB you will be able to see exactly what was recorded and it will then be simple to figure out what information you need to generalise the procedure.

Next you want to take the information from a cell and use that information for the sheet name. VB is event driven so you need to find the event that will trigger the change. I would suggest the Worksheet_Change event.

There are some ramifications in doing this though- especially if you are using multiple worksheets. The sheet name often is needed in referrring to a cell and if they can dynamically change, then your VB code will return an error at some point when the sheet names do no match. You need to think as to how to work around this. Not knowing you application I can't help you further.

You can get a good idea of how to work with Excel and electronics from my book
"Excel by Example : A Microsoft Excel Cookbook for Electronics Engineers " ISBN 0750677562, published by Elsevier/Newnes. It covers most of what you are asking here.

Incidentally, the book was based on a series of 3 articles in Circuit Cellar Online
**broken link removed**
**broken link removed**
**broken link removed**

This will give you a general tutorial. The book has a different approach and is much more detailed with many more examples.

-Aubrey Kagan
 

unable to download the pdf from there
 

you can check out mrexcel.com page, they have pretty good site for learning excel and they have a good message board too.

what i think you are trying to do is a macro, but really not sure what you mean.

If it's a macro, i've learn most of the things i do with macros by recording one and then changing the code that it generates with the things i want, and creating the for loops nedded to customisize the code for my apllication.
 

Thanks everyone for your helping,
I will look those sites.

Regrads,
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…