Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 10th, 2008, 06:36 AM
Registered User
 
Join Date: Jun 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Translating WorkSheet Formula in VBA

Hello,

I have the following formula in a cell in my spreadsheet:
Code:
=IF(B1726="", "", B1726 & " (version: " & F1726 & ")")
... which I want to automate in VBA.

I've tried:
Code:
ActiveCell.Formula = "=IF(B1726="", "", B1726 & " (version: " & F1726 & ")")
but it doesn't work.

Am not sure how to translate from one to the other.

Thank you in advance for any help ...

Andy :)

Reply With Quote
  #2 (permalink)  
Old June 10th, 2008, 01:16 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

try
Code:
ActiveCell.Formula = "=IF(B1726="""", """", B1726 & "" (version: "" & F1726 & "")"")"
Every place you want a " to appear in the string that gets installed as the formula, use "". Just one doublequote [DQ] by itself ends the interpreter reading your typing as a literal string. Two DQs in a row are interpreted as one DQ in the string you are creating.
Reply With Quote
  #3 (permalink)  
Old June 11th, 2008, 05:13 AM
Registered User
 
Join Date: Jun 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Understood - thank you :)

Reply With Quote
Reply


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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel formula not working in vba yogeshyl Excel VBA 2 December 12th, 2007 02:27 AM
Excel formula not working in VBA yogeshyl Excel VBA 2 July 19th, 2007 04:57 AM
inserting worksheet into an OLE field with VBA Mihai B Excel VBA 2 January 21st, 2005 06:50 AM
inserting worksheet into an OLE field with VBA Mihai B Access VBA 0 November 23rd, 2004 10:28 AM
Problems introducing a formula using VBA mariona_cid Excel VBA 0 June 1st, 2004 08:01 PM



All times are GMT -4. The time now is 10:40 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.