Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Mocro trouble - Sum if and check for formula

I am tring to create a macro that will fill in a shread sheet with based on
the information in antoher workbook.

Here is what i am trying to do:

Get a file to 'read' - (file = Application.GetOpenFilename)

If the cell in the current book contains a formuls do nothing

If not then do the equivelent of this formula:
=IF($C8"",SUMIF([file]Sheet1!$D:$D, $C8, [file]Sheet1!$E:$E),"")

move down one cell and repeat

do until the end of the current column.

when it goes down each row the SUMIF would need to increment C9 then C10 etc
etc

Any help will be much appriciated.

Cheers

Tom


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Mocro trouble - Sum if and check for formula

ok, i'll bite.........
something like this UNTESTED pseudocode:

sub TomK()
dim Myws as worksheet
my Myrng as range
dim Myrow as long
dim Endrow as long

Application.GetOpenFilename "blah blah"
set Myws =activesheet
set myrng = whatever cell you want to look @
set Myrow = myrng.row
set endrow = cells(5000,1).end(xlup).row

do until myrow = endrow
set myrng = "a" & myrow
if myrng = "" then
'do nothing
else
myrng = " =IF($C" & myrow & """"",SUMIF([file]Sheet1!$D:$D, $C" &
myrow ", _
[file]Sheet1!$E:$E),"""")"
end if
set myrng = "a" & myrow +1
loop

end sub

this hopefully will get you started!
susan


On Mar 9, 7:56 am, TomK wrote:
I am tring to create a macro that will fill in a shread sheet with based on
the information in antoher workbook.

Here is what i am trying to do:

Get a file to 'read' - (file = Application.GetOpenFilename)

If the cell in the current book contains a formuls do nothing

If not then do the equivelent of this formula:
=IF($C8"",SUMIF([file]Sheet1!$D:$D, $C8, [file]Sheet1!$E:$E),"")

move down one cell and repeat

do until the end of the current column.

when it goes down each row the SUMIF would need to increment C9 then C10 etc
etc

Any help will be much appriciated.

Cheers

Tom



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
I'm new at this - having trouble with a formula Dave Excel Discussion (Misc queries) 3 January 8th 06 02:16 AM
Mocro code for sending a worksheet in a mail message Lorenzo Excel Discussion (Misc queries) 1 August 31st 05 10:49 PM
Trouble with formula Keith Excel Discussion (Misc queries) 10 May 22nd 05 11:33 PM
Formula with a variable in a mocro Huge project Excel Programming 1 December 28th 04 11:09 AM
copy a mocro to another pc. HELP!!!!!!!!!!!!!!!!!!!! vincenzo Excel Programming 3 October 29th 03 03:33 PM


All times are GMT +1. The time now is 06:24 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"