LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default How to link strings in a formula in VBA?

Hi,

I've run into a problem I can't come around:

I want to give a number of cells a formula:

=DSUMMA(Listan!$D:$G;"Förbrukning";AH4:AI5)

(DSUMMA equals DSUM in the Swedish version, and the cell reference AH4:AI5
changes for each target cell)

I do it in VBA like this (don't mind the i:s and j:s):

Cells(114 + 15 * i + j, 3).Value = "=DSUMMA(Listan!$D:$G;""Förbrukning"";" &
Range(Cells(2 + 2 * j, 34 + 2 * i), Cells(3 + 2 * j, 35 + 2 * i)).Address &
")"

The connection between the target cell and the reference cells is a bit
messy, hence the i:s and j:s.

However, this generate a 1004 error, which I trace to the "=DSUMMA"-string;
Excel refuses to accept the formula. Showing the whole string
("=DSUMMA(...)") in a msgbox gives a correct syntax and is exactly what I
want to put in the cells (which works if I do).

How do I overcome this?

Thanks
/Stefan
 
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
find and replace numeric strings in larger text strings Mr Molio Excel Worksheet Functions 8 November 9th 11 05:17 PM
Evaluating a DDE formula created by strings JessicaRowe Excel Worksheet Functions 2 September 18th 09 10:48 AM
Use Formula to sort two strings Ray Ray Excel Worksheet Functions 2 January 15th 08 12:37 PM
Formula that will ignore strings [email protected] Excel Programming 1 December 6th 06 11:27 AM
How to find number of pairs of strings from list of strings? greg_overholt Excel Worksheet Functions 5 January 27th 06 10:42 PM


All times are GMT +1. The time now is 10:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"