Your code worked ok for me when I had two sheets named a_data and a_report.
But if the names were different (leading/trailing spaces), then it didn't work.
Just a guess. Does that underscore really mean an underscore--or is a way of
showing a space character.
If you really have "a data" and "a report", try:
Sheets("a report").Cells(1, 1).Formula = "=SUMIF('a data'!A:A,0,'a data'!B:B)"
In fact, those extra apostrophes in the formula won't matter to excel if you
don't actually need them.
If that's not it, try renaming the sheet one more time. And be careful with
those leading/trailing spaces.
jesmin wrote:
Hi The
In my workbook, name of 2 worksheets are a_data & a_report. I am
getting correct result when I am using the following in another trial
sheet:
Sheets("Sheet2").Cells(1,1).Formula="=SUMIF(Sheet1 !A:A,0,Sheet1!B:B)".
But when I am using my original workbook code with the original name as
follows, its giving run-time error.:
Sheets("a_report").Cells(1,1).Formula="=SUMIF(a_da
ta!A:A,0,a_data!B:B)"
--why the reference creating problem when I am chanhging just the sheet
name from Shee1 to a_data.
Thanks in advance.
--
jesmin
------------------------------------------------------------------------
jesmin's Profile: http://www.excelforum.com/member.php...o&userid=29540
View this thread: http://www.excelforum.com/showthread...hreadid=508357
--
Dave Peterson