2 macro questions

stipsoff

New Member
Joined
Sep 7, 2009
Messages
4
Hello to all,
I'm new to the usage of excel and I have 2 questions for anyone who is kind enough to anwser them and pls give me an example for solving my problem.

1. How can I count the number of sheet in one file?
2. How can I import data from other excel files?

PS. Could anyone suggest a good book, tutorial or something else about macros or/and similar topics?

Tnx
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Code:
public function no_of_worksheets() as long
no_of_worksheets = thisworkbook.sheets.count
end function

for the first part. the second one you need to be more specify.

A book - I can't remember the one that I had. I actually gained more by answering questions from this board, getting it wrong and learning. thanks

Kaps
 
Upvote 0
Tnx for the anwser Kaps.
As for my second question, to specify it my situation is the following:
I've got another excel file from which I need to import into my current one a few numbers. Let's say it's B12, C4 and E7. Now how do I connect to that file and pull out those values into my current file?
 
Upvote 0
Tnx for the anwser Kaps.
As for my second question, to specify it my situation is the following:
I've got another excel file from which I need to import into my current one a few numbers. Let's say it's B12, C4 and E7. Now how do I connect to that file and pull out those values into my current file?
Depends a bit on your situation but you can directly link to another workbook by entering in the formula:
Code:
='[other workbook.xls]sheet name'!$B$!"
If you are talking about larger amounts of data a macro can be used.
 
Upvote 0
In the meantime I've got a few things done but I also got a few more things I have to implement. So the situation right now is the following:
-I've got some reports with the names a200906, a200907 and a200908
-For this next month and everyone that follows I'll have to make another report with the name a200909 accordingly
-In order to make this I need to import some data (3 cells in total to be exact) from the one before that and do something with them

So the question is how can I according to the report name, ie. a200909 conclude that I want to open a200908 to get the data I want? (I'm thinking somekind of string to int fuction, substract 1 from the number, int to string again, and open the filename)
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top