I just put the code into a button event and it works fine.
One thing though ... You have qualified your first line's range to be in
Parents2, but your other two lines don't specify a sheet, so will default to
the active sheet.
You can change the active sheet between steps while you're in debug mode,
and this would affect the following code.
Regards, Dave S
----- Original Message -----
From: "mickey11030" <mickey11030@yahoo.com>
To: <ExcelVBA@yahoogroups.com>
Sent: Sunday, March 11, 2012 8:06 AM
Subject: [ExcelVBA] This Can't Be Happening
>I have a spreadsheet in which I use a UDF to calculate Customer Price. My
>code is:
>
>
> Sheets("Parents2").Range("F2").Formula = "=CalCustomerPrice(E2)"
> Range("F2").Select
> Selection.autofill Destination:=Range("F2:F" & ParentRows)
>
> If I step through this code, it works perfectly, but if I execute it, only
> F2 contains the correct content. The other cells in Col F are blank. No
> error message. ParentRows has a value of 233.
>
> Is there any non-mystical explanation for this behavior?
>
> Thanks,
> Michael Trombetta
>
>
>
>
> ------------------------------------
>
> ----------------------------------
> Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go
> here: http://www.mousetrax.com/techtrax to enter the ezine, then search
> the ARCHIVES for EXCEL VBA.
>
> ----------------------------------
> Visit our ExcelVBA group home page for more info and support files:
> http://groups.yahoo.com/group/ExcelVBA
>
> ----------------------------------
> More free tutorials and resources available at:
> http://www.mousetrax.com
>
> ----------------------------------Yahoo! Groups Links
>
>
>
>
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar