Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Concatenate with Underscore in formula

Hi All.....

I am trying to use VBA to place a formula in a cell that is a concatenation
of two cells using an underscore between them. The formula works fine when
used on the sheet, but VBA balks at the underscores.......is there some
special combination of characters to allow the underscore.....

My code reads something like this

formula = "=A1&"_"&B1"

Any help would be appreciated,
Vaya con Dios,
Chuck, CABGx3







  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Concatenate with Underscore in formula

I think you problem is not with the underscore, but trying to embed double
quotes within you string

formula = "=A1&""_""&B1"
? formula
=A1&"_"&B1



so double your double quotes when used within a string

--
Regards,
Tom Ogilvy


"CLR" wrote in message
...
Hi All.....

I am trying to use VBA to place a formula in a cell that is a

concatenation
of two cells using an underscore between them. The formula works fine

when
used on the sheet, but VBA balks at the underscores.......is there some
special combination of characters to allow the underscore.....

My code reads something like this

formula = "=A1&"_"&B1"

Any help would be appreciated,
Vaya con Dios,
Chuck, CABGx3









  #3   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Concatenate with Underscore in formula

Cool Tom.........thanks many bunches, that solved the problem. My actual
formula was a long IF-VLOOKUP string and also included a null "" thing that
needed the same treatment.

I much appreciate your help......

Vaya con Dios,
Chuck, CABGx3



"Tom Ogilvy" wrote:

I think you problem is not with the underscore, but trying to embed double
quotes within you string

formula = "=A1&""_""&B1"
? formula
=A1&"_"&B1



so double your double quotes when used within a string

--
Regards,
Tom Ogilvy


"CLR" wrote in message
...
Hi All.....

I am trying to use VBA to place a formula in a cell that is a

concatenation
of two cells using an underscore between them. The formula works fine

when
used on the sheet, but VBA balks at the underscores.......is there some
special combination of characters to allow the underscore.....

My code reads something like this

formula = "=A1&"_"&B1"

Any help would be appreciated,
Vaya con Dios,
Chuck, CABGx3










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
underscore in functions westronwynde Excel Worksheet Functions 4 May 6th 23 11:45 AM
underscore in email address covered by hyperlink underscore Chuck Bowser Excel Discussion (Misc queries) 1 April 22nd 09 05:47 PM
How can I double underscore in excel? KennyG Excel Worksheet Functions 2 December 20th 06 08:46 PM
Underscore in Excel Title Bar Chris Gorham[_3_] Excel Programming 1 December 22nd 03 12:15 PM
Underscore character _ Todd Huttenstine[_2_] Excel Programming 1 November 25th 03 05:08 AM


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