excel VBA sheets name

Joined
May 11, 2011
Messages
14
Reaction score
0
Hy everyone.

My english is very bad, so im sorry for any mistakes...


I have data on different sheets called data 2011, data 2010, data 2009, data 2008 and so on. For each year I want to summarize some of the information, lots of them.

That's why I wanted to do with the order for:
for i = 2007 to 2010
I do not know if I can somehow instead of sheet ("Data 2007"). Cells (2.2) to write "data 2007" as a variable with variables i

Thank you in advance.
 
Do you need to write VBA, or can you use a workbook function (sum for example)
=sum(2007:2011,B2)

Stoneboysteve
 
Hy, i found a solution

I didn't know, i needed something like this

for i=2007 to 2010
nameofsheet="Data "+right(i,4)
if Sheets(nameofsheet).cells(....


any way, i didn't know that you can take variable that has Dim as String for name of sheet.

And i didn't know how i can make name "Data 2007" from variable i (in this example)

Now i have a new problem
How to use vlookup function in VBA, but i found solution on internet

Tnx anyway
 
Back
Top