Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Formula Problem in Macro

I am writing a macro that is generating a formula. This formula, once
the macro runs, is changing in appearance. To better explain, here is
an example:

The macro builds the formula like this:

"=INDEX(Sheet2!B:B,MATCH(Sheet1!D" & i & ",Sheet2!A:A,0))"

where "i" is set in a loop.


I am expecting the spreadsheet to reflect this:

=INDEX(Sheet2!B:B,MATCH(Sheet1!D2,Sheet2!A:A,0))

but I am getting this:

=INDEX(Sheet2!B:B,MATCH(Sheet1!'D2',Sheet2!A:A,0))


Excel is putting tick marks around the cell reference and is causing
the formula to fail. The expected formula does work because I can
manually take the tick marks out and get the result I am looking for.

Can some help me in building the formula so the tick marks are not
produced? Thanks.

DJ

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,574
Default Formula Problem in Macro

D2 is a cell reference but it appears you're using it as a sheet name?
That's why the tick marks appear. Test it out on another workbook/formula.

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.


" wrote:

I am writing a macro that is generating a formula. This formula, once
the macro runs, is changing in appearance. To better explain, here is
an example:

The macro builds the formula like this:

"=INDEX(Sheet2!B:B,MATCH(Sheet1!D" & i & ",Sheet2!A:A,0))"

where "i" is set in a loop.


I am expecting the spreadsheet to reflect this:

=INDEX(Sheet2!B:B,MATCH(Sheet1!D2,Sheet2!A:A,0))

but I am getting this:

=INDEX(Sheet2!B:B,MATCH(Sheet1!'D2',Sheet2!A:A,0))


Excel is putting tick marks around the cell reference and is causing
the formula to fail. The expected formula does work because I can
manually take the tick marks out and get the result I am looking for.

Can some help me in building the formula so the tick marks are not
produced? Thanks.

DJ


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Formula Problem in Macro

On Apr 3, 1:11 pm, wrote:
I am writing a macro that is generating a formula. This formula, once
the macro runs, is changing in appearance. To better explain, here is
an example:

The macro builds the formula like this:

"=INDEX(Sheet2!B:B,MATCH(Sheet1!D" & i & ",Sheet2!A:A,0))"

where "i" is set in a loop.

I am expecting the spreadsheet to reflect this:

=INDEX(Sheet2!B:B,MATCH(Sheet1!D2,Sheet2!A:A,0))

but I am getting this:

=INDEX(Sheet2!B:B,MATCH(Sheet1!'D2',Sheet2!A:A,0))

Excel is putting tick marks around the cell reference and is causing
the formula to fail. The expected formula does work because I can
manually take the tick marks out and get the result I am looking for.

Can some help me in building the formula so the tick marks are not
produced? Thanks.

DJ


Is there anyone who can help me with this?

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
Problem with Macro rdwj Excel Discussion (Misc queries) 0 March 28th 07 01:13 AM
Problem in macro Micos3 Excel Discussion (Misc queries) 2 February 23rd 06 02:20 PM
Macro problem Bonbon Excel Worksheet Functions 2 February 18th 06 08:07 PM
Macro Problem tweacle Excel Worksheet Functions 1 January 12th 06 05:46 PM
Macro problem Jim New Users to Excel 2 March 16th 05 07:36 PM


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