Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default VBA HELP! MsgBox & File & Sumif ******

Hi everyone,

I was wondering if anyone can help with my problem.


I have a workbook containing three worksheets; 'sheet1', 'sheet2' and
'sheet3'. And;

1. On 'sheet1' I have name of the months from B5 to AO5
- i.e. Jan - 05 to Apr - 08

2. 'sheet1' Cell A1 contains the name of the workbook "ABC123"

3. From 'sheet1" cell A6 till A25. I have codes in combination of
number and alphabet structure.
- i.e. OTO35, VOF05 etc ( 3 letters and 2 number at the end )

4. On my directory 'C:\Documents\Database' Under the Database folder
I have many different kinds of representative name folders such as
"ABC123", "DEF456", "ABB768" and so on.

5. Inside of this each name folder, It has 4 different year folders
called "2005", "2006", "2007" and "2008". Inside of these year
folders, I have excel files name in month as this "Jan 05", "Feb 05"
all the way to "Dec 05" and so on. It is same with other year folders
except the last two number digit from the name where in folder "2007",
it will have excel file name "Jan 07" ~"Dec 07".


6. On 'sheet1' cell B6 which will be underneath cell B5(Jan-05), I
need to open 'C:\Documents\Database'\ABC123\2005\Jan 05.xls' file then
do the sumif on cell A6 which contains the code "OTO35".



=== Here is the problem that I can't solve. What I can do with my
small brain in VBA is to actually tell it to open up the file under
directory 'C:\Documents\Database'\ABC123\2005\Jan 05.xls' then do
sumif of A6 on Jan 05.xls Range A:J and sum data column J, then put it
on B6.

- Is there any possible way to program in VBA in such way that when
msgbox pops up at the very start and I just type in the file name
"ABC123" or refer to cell A1 or whatever, Open up the correct file on
correct month then do a sumif automatically?

i.e.

A. if file name is ABC123 for this report then go to path 'C:\Documents
\Database'\ABC123\
if file name is DEF456 then go to path 'C:\Documents
\Database'\DEF456\

B. Then, if it is Jan-05 go to correct year folder under then open up
correct xls file. i.e. 'C:\Documents\Database'\ABC123\2005\Jan 05.xls

C. Do a sumif of A6 from Jan 05 file from Range A:J and sum data on
column J.

D. Repeat this step from Jan - 05 to Apr - 08 (B5 to AO5) then getting
results cells underneath.



I am pretty sure there will be alot better and efficient way of doing
this.

If anyone can help or give me an advice how this can be done, that
would be wonderful!

Thanks guys!! :D





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default VBA HELP! MsgBox & File & Sumif ******

Are B5:AO5 real dates, or strings of month/years?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"James8309" wrote in message
...
Hi everyone,

I was wondering if anyone can help with my problem.


I have a workbook containing three worksheets; 'sheet1', 'sheet2' and
'sheet3'. And;

1. On 'sheet1' I have name of the months from B5 to AO5
- i.e. Jan - 05 to Apr - 08

2. 'sheet1' Cell A1 contains the name of the workbook "ABC123"

3. From 'sheet1" cell A6 till A25. I have codes in combination of
number and alphabet structure.
- i.e. OTO35, VOF05 etc ( 3 letters and 2 number at the end )

4. On my directory 'C:\Documents\Database' Under the Database folder
I have many different kinds of representative name folders such as
"ABC123", "DEF456", "ABB768" and so on.

5. Inside of this each name folder, It has 4 different year folders
called "2005", "2006", "2007" and "2008". Inside of these year
folders, I have excel files name in month as this "Jan 05", "Feb 05"
all the way to "Dec 05" and so on. It is same with other year folders
except the last two number digit from the name where in folder "2007",
it will have excel file name "Jan 07" ~"Dec 07".


6. On 'sheet1' cell B6 which will be underneath cell B5(Jan-05), I
need to open 'C:\Documents\Database'\ABC123\2005\Jan 05.xls' file then
do the sumif on cell A6 which contains the code "OTO35".



=== Here is the problem that I can't solve. What I can do with my
small brain in VBA is to actually tell it to open up the file under
directory 'C:\Documents\Database'\ABC123\2005\Jan 05.xls' then do
sumif of A6 on Jan 05.xls Range A:J and sum data column J, then put it
on B6.

- Is there any possible way to program in VBA in such way that when
msgbox pops up at the very start and I just type in the file name
"ABC123" or refer to cell A1 or whatever, Open up the correct file on
correct month then do a sumif automatically?

i.e.

A. if file name is ABC123 for this report then go to path 'C:\Documents
\Database'\ABC123\
if file name is DEF456 then go to path 'C:\Documents
\Database'\DEF456\

B. Then, if it is Jan-05 go to correct year folder under then open up
correct xls file. i.e. 'C:\Documents\Database'\ABC123\2005\Jan 05.xls

C. Do a sumif of A6 from Jan 05 file from Range A:J and sum data on
column J.

D. Repeat this step from Jan - 05 to Apr - 08 (B5 to AO5) then getting
results cells underneath.



I am pretty sure there will be alot better and efficient way of doing
this.

If anyone can help or give me an advice how this can be done, that
would be wonderful!

Thanks guys!! :D







  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default VBA HELP! MsgBox & File & Sumif ******

Are B5:AO5 real dates, or strings of month/years?

= I just typed Jan 05 in cell B5 then did autofill to AO5.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VBA HELP! MsgBox & File & Sumif ******

Hi Everyone!

Was anyone able to help with this?

I need help with the following section from that query:

" Is there any possible way to program in VBA in such way that when
msgbox pops up at the very start and I just type in the file name
"ABC123" Open up the correct file on
correct month?

i.e.

A. if file name is ABC123 for this report then go to path 'C:\Documents
\Database'\ABC123\
if file name is DEF456 then go to path 'C:\Documents
\Database'\DEF456\

B. Then, if it is Jan-05 go to correct year folder under then open up
correct xls file. i.e. 'C:\Documents\Database'\ABC123\2005\Jan 05.xls "

Many Thanks!






"James8309" wrote:

Are B5:AO5 real dates, or strings of month/years?


= I just typed Jan 05 in cell B5 then did autofill to AO5.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 239
Default VBA HELP! MsgBox & File & Sumif ******

On May 20, 8:05*pm, alshiks wrote:
Hi Everyone!

Was anyone able to help with this?

I need help with the following section from that query:

" *Is there any possible way to program in VBA in such way that when
msgbox pops up at the very start and I just type in the file name
"ABC123" *Open up the correct file on
correct month?

i.e.

A. if file name is ABC123 for this report then go to path 'C:\Documents
\Database'\ABC123\
if file name is DEF456 then go to path 'C:\Documents
\Database'\DEF456\

B. Then, if it is Jan-05 go to correct year folder under then open up
correct xls file. i.e. 'C:\Documents\Database'\ABC123\2005\Jan 05.xls "

Many Thanks!



"James8309" wrote:
Are B5:AO5 real dates, or strings of month/years?


= I just typed Jan 05 in cell B5 then did autofill to AO5.- Hide quoted text -


- Show quoted text -


see your other post.
Regards,
Madiya


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VBA HELP! MsgBox & File & Sumif ******

which other post?

"Madiya" wrote:

On May 20, 8:05 pm, alshiks wrote:
Hi Everyone!

Was anyone able to help with this?

I need help with the following section from that query:

" Is there any possible way to program in VBA in such way that when
msgbox pops up at the very start and I just type in the file name
"ABC123" Open up the correct file on
correct month?

i.e.

A. if file name is ABC123 for this report then go to path 'C:\Documents
\Database'\ABC123\
if file name is DEF456 then go to path 'C:\Documents
\Database'\DEF456\

B. Then, if it is Jan-05 go to correct year folder under then open up
correct xls file. i.e. 'C:\Documents\Database'\ABC123\2005\Jan 05.xls "

Many Thanks!



"James8309" wrote:
Are B5:AO5 real dates, or strings of month/years?


= I just typed Jan 05 in cell B5 then did autofill to AO5.- Hide quoted text -


- Show quoted text -


see your other post.
Regards,
Madiya

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to generate a msgbox telling how large the file is robs3131 Excel Programming 5 April 24th 08 01:33 PM
clear the file now available msgbox Jive Excel Worksheet Functions 2 January 14th 08 12:08 PM
Pop up MsgBox upon opening Excel File certain_death Excel Discussion (Misc queries) 5 June 2nd 06 12:38 PM
Msgbox saying "Unable to read file" lashio Excel Discussion (Misc queries) 3 May 30th 05 07:59 PM
Display Current File Name in MsgBox Paul Moles[_2_] Excel Programming 4 November 26th 03 02:22 PM


All times are GMT +1. The time now is 09:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"