MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old May 16th, 2002, 05:58 AM   #1
Matt
Board Regular
 
Join Date: Feb 2002
Location: England
Posts: 212
Default

I have been using this formula entered directly into a cell and it works fine, when I try to enter it through VB, it brings up a syntax error stopping at the 4th quote mark. Any ideas on how I can avoid this.

Worksheets("sheet1").Range("e42").formula = "=if Q42 <> "", CONCATENATE("Job Completed "&TEXT(Q42,"dd/mm/yy")"
),IF(P42<>"",CONCATENATE("Work Started "&TEXT(P42,"dd/mm/yy")),IF(O42<>"",CONCATENATE("Scheduled To Start "&TEXT(O42,"dd/mm/yy")),IF(H42<>"","Programmer Allocated",IF(M42<>"",CONCATENATE("Received By IT "&TEXT(M42,"dd/mm/yy")),""))))))"


thanks

Matt
Matt is offline   Reply With Quote
Old May 16th, 2002, 06:14 AM   #2
dimrod
 
Join Date: May 2002
Posts: 73
Default

I don't think that the formula you posted can work in a cell.

Anyway, try this (might not work - haven't tried it) :-

=IF(Q42 <> "", CONCATENATE("Job Completed "&TEXT(Q42,"dd/mm/yy")),IF(P42<>"",CONCATENATE("Work Started "&TEXT(P42,"dd/mm/yy")),IF(O42<>"",CONCATENATE("Scheduled To Start "&TEXT(O42,"dd/mm/yy")),IF(H42<>"","Programmer Allocated",IF(M42<>"",CONCATENATE("Received By IT "&TEXT(M42,"dd/mm/yy")),"")))))
dimrod is offline   Reply With Quote
Old May 16th, 2002, 06:24 AM   #3
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Quote:
On 2002-05-16 04:58, Matt wrote:
I have been using this formula entered directly into a cell and it works fine, when I try to enter it through VB, it brings up a syntax error stopping at the 4th quote mark. Any ideas on how I can avoid this.

Worksheets("sheet1").Range("e42").formula = "=if Q42 <> "", CONCATENATE("Job Completed "&TEXT(Q42,"dd/mm/yy")"
),IF(P42<>"",CONCATENATE("Work Started "&TEXT(P42,"dd/mm/yy")),IF(O42<>"",CONCATENATE("Scheduled To Start "&TEXT(O42,"dd/mm/yy")),IF(H42<>"","Programmer Allocated",IF(M42<>"",CONCATENATE("Received By IT "&TEXT(M42,"dd/mm/yy")),""))))))"


thanks

Matt
Hi Matt
I believe your formula should be;
'
'

Worksheets("sheet1").Range("e42").Formula _
"=IF(Q42<>"""",CONCATENATE(""Job Completed ""&TEXT(Q42,""dd/mm/yy""))," _
& "IF(P42<>"""",CONCATENATE(""Work Started ""&TEXT(P42,""dd/mm/yy""))," _
& "IF(O42<>"""",CONCATENATE(""Scheduled To Start ""&TEXT(O42,""dd/mm/yy""))," _
& "IF(H42<>"""",""Programmer Allocated"",IF(M42<>"""",CONCATENATE(""Received By IT ""&TEXT(M42,""dd/mm/yy"")),"""")))))"


__________________
Kind Regards,
Ivan F Moala From the City of Sails
Ivan F Moala is offline   Reply With Quote
Old May 16th, 2002, 07:53 AM   #4
Matt
Board Regular
 
Join Date: Feb 2002
Location: England
Posts: 212
Default

Thanks guys

Ivan - tried your method and getting the error object doesn't support this property/method.

Any ideas

thanks

Matt

[ This Message was edited by: Matt on 2002-05-16 06:56 ]
Matt is offline   Reply With Quote
Old May 16th, 2002, 07:58 AM   #5
dimrod
 
Join Date: May 2002
Posts: 73
Default

I think Ivan inadvertently missed out an = sign. First line should be :-

Worksheets("sheet1").Range("e42").Formula = _
dimrod is offline   Reply With Quote
Old May 16th, 2002, 08:03 AM   #6
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Quote:
On 2002-05-16 06:53, Matt wrote:
Thanks guys

Ivan - tried your method and getting the error object doesn't support this property/method.

Any ideas

thanks

Matt

[ This Message was edited by: Matt on 2002-05-16 06:56 ]
Matt..sorry silly mistake try:
'
'

Worksheets("Sheet1").Range("e42").Formula = _
"=IF(Q42<>"""",CONCATENATE(""Job Completed ""&TEXT(Q42,""dd/mm/yy""))," _
& "IF(P42<>"""",CONCATENATE(""Work Started ""&TEXT(P42,""dd/mm/yy""))," _
& "IF(O42<>"""",CONCATENATE(""Scheduled To Start ""&TEXT(O42,""dd/mm/yy""))," _
& "IF(H42<>"""",""Programmer Allocated"",IF(M42<>"""",CONCATENATE(""Received By IT ""&TEXT(M42,""dd/mm/yy"")),"""")))))"

__________________
Kind Regards,
Ivan F Moala From the City of Sails
Ivan F Moala is offline   Reply With Quote
Old May 16th, 2002, 08:05 AM   #7
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Quote:
On 2002-05-16 06:58, dimrod wrote:
I think Ivan inadvertently missed out an = sign. First line should be :-

Worksheets("sheet1").Range("e42").Formula = _
Thanks Dimrod
maybe a liitle less haste........
__________________
Kind Regards,
Ivan F Moala From the City of Sails
Ivan F Moala is offline   Reply With Quote
Old May 16th, 2002, 08:07 AM   #8
Matt
Board Regular
 
Join Date: Feb 2002
Location: England
Posts: 212
Default

Top Man, that's perfect, thanks again to both of you!
Matt is offline   Reply With Quote
Old May 16th, 2002, 08:23 AM   #9
Matt
Board Regular
 
Join Date: Feb 2002
Location: England
Posts: 212
Default

Sorry Guys to bother you again, I'm trying to force a variable into the equation "row", which changes the row that the formula calculates. At the moment, the variable appears in the formula as text and not as the variable integer as it should. I know the variable is Ok as it appears in the same procedure out of a formula and functions correctly. Hope you can help


Formula used:

Worksheets("sheet1").Range("e" & row).Formula = "=IF(Q & row<>"""",CONCATENATE(""Job Completed ""&TEXT(Q & row,""dd/mm/yy""))," _
& "IF(P & row<>"""",CONCATENATE(""Work Started ""&TEXT(P & row,""dd/mm/yy""))," _
& "IF(O & row<>"""",CONCATENATE(""Scheduled To Start ""&TEXT(O & row,""dd/mm/yy""))," _
& "IF(H & row<>"""",""Programmer Allocated"",IF(M & row<>"""",CONCATENATE(""Received By IT ""&TEXT(M & row,""dd/mm/yy"")),"""")))))"


Formula that appears in cell

=IF(Q & row<>"",CONCATENATE("Job Completed "&TEXT(Q & row,"dd/mm/yy")),IF(P & row<>"",CONCATENATE("Work Started "&TEXT(P & row,"dd/mm/yy")),IF(O & row<>"",CONCATENATE("Scheduled To Start "&TEXT(O & row,"dd/mm/yy")),IF(H & row<>"","Programmer Allocated",IF(M & row<>"",CONCATENATE("Received By IT "&TEXT(M & row,"dd/mm/yy")),"")))))
thanks

Matt

[ This Message was edited by: Matt on 2002-05-16 07:24 ]

[ This Message was edited by: Matt on 2002-05-16 07:33 ]
Matt is offline   Reply With Quote
Old May 16th, 2002, 08:45 AM   #10
kkknie
Board Regular
 
Join Date: Apr 2002
Location: Greenwood, SC
Posts: 677
Default

Try this:

Worksheets("sheet1").Range("e" & Row).Formula = "=IF(Q" & Row & "<>"""",CONCATENATE(""Job Completed ""&TEXT(Q" & Row & ",""dd/mm/yy""))," _
& "IF(P" & Row & "<>"""",CONCATENATE(""Work Started ""&TEXT(P" & Row & ",""dd/mm/yy""))," _
& "IF(O" & Row & "<>"""",CONCATENATE(""Scheduled To Start ""&TEXT(O" & Row & ",""dd/mm/yy""))," _
& "IF(H" & Row & "<>"""",""Programmer Allocated"",IF(M" & Row & "<>"""",CONCATENATE(""Received By IT ""&TEXT(M" & Row & ",""dd/mm/yy"")),"""")))))"

Since you are just creating a huge string, you have to keep the row variable outside of the quotes so that it will use its value and not the string row.

K
kkknie is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On

Forum Jump


All times are GMT -4. The time now is 02:08 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes