PC Review


Reply
Thread Tools Rate Thread

Strange thing with this formula written by VBA

 
 
tempest@ucla.edu
Guest
Posts: n/a
 
      1st Jul 2003
Hi all.

I ran into a problem where the cell formulas deviate from what my VBA
code wrote to them.

Example:

My VBA code wrote the following string to formula property of a
selected cell:

=VLOOKUP(B11,LaborDataQuery!BW_LaborData,2,FALSE)

where "LaborDataQuery" is the name of a separate worksheet in the same
workbook and "BW_LaborData" is the name of the query table (or named
range) in "LaborDataQuery" worksheet.

However, the final formula shown in the cell became this:

=VLOOKUP(B11,APPWG.XLS!BW_LaborData,2,FALSE)

Where "APPWG.XLS" is the file name of the workbook.

I don't know why Excel changed the worksheet name in my formula to the
file name of the workbook.

Entering the correct formula directly in Excel's formula bar does not
have this problem.

If anyone knows why this anomaly occurred, please let me know.

Thanks.

Jason

 
Reply With Quote
 
 
 
 
Orlando Magalhães Filho
Guest
Posts: n/a
 
      1st Jul 2003
Hi,

Because the name "BW_LaborData" on LaborDataQuery sheet is defined as
workbook name. Try define as sheet name. Do this:

- Active LaborDataQuery sheet;
- Select the BW_LaborData range;
- Go Insert menu > Name submenu > Define command
- Select BW_LaborData name and Delete
- Now insert LaborDataQuery!BW_LaborData
- Press Add and OK


HTH

---
Orlando Magalhães Filho

(So that you get best and rapid solution and all may benefit from the
discussion, please reply within the newsgroup, not in email)

<(E-Mail Removed)> escreveu na mensagem
news:(E-Mail Removed)...
> Hi all.
>
> I ran into a problem where the cell formulas deviate from what my VBA
> code wrote to them.
>
> Example:
>
> My VBA code wrote the following string to formula property of a
> selected cell:
>
> =VLOOKUP(B11,LaborDataQuery!BW_LaborData,2,FALSE)
>
> where "LaborDataQuery" is the name of a separate worksheet in the same
> workbook and "BW_LaborData" is the name of the query table (or named
> range) in "LaborDataQuery" worksheet.
>
> However, the final formula shown in the cell became this:
>
> =VLOOKUP(B11,APPWG.XLS!BW_LaborData,2,FALSE)
>
> Where "APPWG.XLS" is the file name of the workbook.
>
> I don't know why Excel changed the worksheet name in my formula to the
> file name of the workbook.
>
> Entering the correct formula directly in Excel's formula bar does not
> have this problem.
>
> If anyone knows why this anomaly occurred, please let me know.
>
> Thanks.
>
> Jason
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange Thing Text Ground Microsoft Word Document Management 7 25th Jun 2009 05:45 PM
Strange thing =?Utf-8?B?RHVmZmllIE1jTGFtYiBKci4=?= Microsoft Frontpage 2 17th Nov 2005 06:40 PM
Re: selecting the written portion in a work sheet and another thing J.E. McGimpsey Microsoft Excel Misc 0 10th Sep 2003 06:32 PM
Re: selecting the written portion in a work sheet and another thing Michael J. Malinsky Microsoft Excel Misc 0 10th Sep 2003 06:06 PM
Strange thing with this formula written by VBA tempest@ucla.edu Microsoft Excel Programming 1 1st Jul 2003 07:11 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:21 AM.