The " character
Hello All,
try as I might I'm stumped... How do I add a " character in a cell form VBA? As in I have a formula that looks something like this: =Something(get data "12/02/2009" to "13/02/2009") Everytime i try to assign it via ar ange.value= i run into problems (as it terminates my statement early) I know it must be possible, and i immagine it to be something trivial. Yet... I'm stumped. Any ideas? Thanks in advance |
The " character
Hi Janos,
How about CHR(34) & "2/19/2009" in VBA or CHAR(34) & "2/19'2009" using worksheet functions. Mike "Janos" wrote: Hello All, try as I might I'm stumped... How do I add a " character in a cell form VBA? As in I have a formula that looks something like this: =Something(get data "12/02/2009" to "13/02/2009") Everytime i try to assign it via ar ange.value= i run into problems (as it terminates my statement early) I know it must be possible, and i immagine it to be something trivial. Yet... I'm stumped. Any ideas? Thanks in advance |
The " character
Janos;228673 Wrote: Hello All, try as I might I'm stumped... How do I add a " character in a cell form VBA? As in I have a formula that looks something like this: =Something(get data "12/02/2009" to "13/02/2009") Everytime i try to assign it via ar ange.value= i run into problems (as it terminates my statement early) I know it must be possible, and i immagine it to be something trivial. Yet... I'm stumped. Any ideas? Thanks in advance Hello Janos, You have to use to use a string to represent the quote and concatenate your formula together. Easier to understand when you see it... ====================================== Range("A1").Value = "=Something(get data" & Chr$(34) & "12/02/2009" & Chr$(34) & " to " & Chr$(34) & "13/02/2009" & Chr$(34) & ")" ====================================== Chr$(34) is the character string code for a double quote. You may want to define a string DQoute and set it to Chr$(34) to make the code easier to read and understand. ====================================== Dim DQuote Range("A1").Value = "=Something(get data" & DQuote & "12/02/2009" & DQuote & " to " & DQuote & "13/02/2009" & DQuote & ")" ====================================== -- Leith Ross Sincerely, Leith Ross 'The Code Cage' (http://www.thecodecage.com/) ------------------------------------------------------------------------ Leith Ross's Profile: http://www.thecodecage.com/forumz/member.php?userid=75 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=63765 |
All times are GMT +1. The time now is 10:32 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com