Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default add empty space in formula

Hi,

Having some trouble with inserting formula.

Sub formula()
Columns("H:H").Select
Selection.Insert Shift:=xlToRight
Range("I1").Select
Selection.Copy
Range("H1").Select
ActiveSheet.Paste
'Range("H2").Select
' Application.CutCopyMode = False
' this is the formula but I get a compile error message end of statement
'activecell.FormulaR1C1 = "=J2&" "&K2"
' I need to put a space between J2 and K2, otherwise the strings
aren't seperated with a space

End Sub


How can I solve this? Or should I
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default add empty space in formula

activecell.FormulaR1C1 = "=J2&"" ""&K2"


demo'd from the immediate window for confidence:

? "=J2&"" ""&K2"
=J2&" "&K2

so double up double quotes when within double quotes

--
regards,
Tom Ogilvy


"Jootje" wrote:

Hi,

Having some trouble with inserting formula.

Sub formula()
Columns("H:H").Select
Selection.Insert Shift:=xlToRight
Range("I1").Select
Selection.Copy
Range("H1").Select
ActiveSheet.Paste
'Range("H2").Select
' Application.CutCopyMode = False
' this is the formula but I get a compile error message end of statement
'activecell.FormulaR1C1 = "=J2&" "&K2"
' I need to put a space between J2 and K2, otherwise the strings
aren't seperated with a space

End Sub


How can I solve this? Or should I

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default add empty space in formula

Hmmm, still not working, this is what I get:

='I2'&" "&'J2'

"Tom Ogilvy" wrote:

activecell.FormulaR1C1 = "=J2&"" ""&K2"


demo'd from the immediate window for confidence:

? "=J2&"" ""&K2"
=J2&" "&K2

so double up double quotes when within double quotes

--
regards,
Tom Ogilvy


"Jootje" wrote:

Hi,

Having some trouble with inserting formula.

Sub formula()
Columns("H:H").Select
Selection.Insert Shift:=xlToRight
Range("I1").Select
Selection.Copy
Range("H1").Select
ActiveSheet.Paste
'Range("H2").Select
' Application.CutCopyMode = False
' this is the formula but I get a compile error message end of statement
'activecell.FormulaR1C1 = "=J2&" "&K2"
' I need to put a space between J2 and K2, otherwise the strings
aren't seperated with a space

End Sub


How can I solve this? Or should I

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default add empty space in formula

try:
activecell.Formula = "=J2&"" ""&K2"



Jootje wrote:

Hmmm, still not working, this is what I get:

='I2'&" "&'J2'

"Tom Ogilvy" wrote:

activecell.FormulaR1C1 = "=J2&"" ""&K2"


demo'd from the immediate window for confidence:

? "=J2&"" ""&K2"
=J2&" "&K2

so double up double quotes when within double quotes

--
regards,
Tom Ogilvy


"Jootje" wrote:

Hi,

Having some trouble with inserting formula.

Sub formula()
Columns("H:H").Select
Selection.Insert Shift:=xlToRight
Range("I1").Select
Selection.Copy
Range("H1").Select
ActiveSheet.Paste
'Range("H2").Select
' Application.CutCopyMode = False
' this is the formula but I get a compile error message end of statement
'activecell.FormulaR1C1 = "=J2&" "&K2"
' I need to put a space between J2 and K2, otherwise the strings
aren't seperated with a space

End Sub


How can I solve this? Or should I


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default add empty space in formula

AH! Thanks, that's it!

"Dave Peterson" wrote:

try:
activecell.Formula = "=J2&"" ""&K2"



Jootje wrote:

Hmmm, still not working, this is what I get:

='I2'&" "&'J2'

"Tom Ogilvy" wrote:

activecell.FormulaR1C1 = "=J2&"" ""&K2"


demo'd from the immediate window for confidence:

? "=J2&"" ""&K2"
=J2&" "&K2

so double up double quotes when within double quotes

--
regards,
Tom Ogilvy


"Jootje" wrote:

Hi,

Having some trouble with inserting formula.

Sub formula()
Columns("H:H").Select
Selection.Insert Shift:=xlToRight
Range("I1").Select
Selection.Copy
Range("H1").Select
ActiveSheet.Paste
'Range("H2").Select
' Application.CutCopyMode = False
' this is the formula but I get a compile error message end of statement
'activecell.FormulaR1C1 = "=J2&" "&K2"
' I need to put a space between J2 and K2, otherwise the strings
aren't seperated with a space

End Sub


How can I solve this? Or should I


--

Dave Peterson



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
How do I free up the space occupied by empty rows? davedadu Excel Discussion (Misc queries) 2 September 25th 09 05:37 PM
How do I move cursor to next empty space?? WANNABE Excel Programming 6 September 23rd 06 03:58 PM
Altering code to accomodate empty space JOUIOUI Excel Programming 2 June 28th 06 05:17 PM
Empty space around charts when copying BillRobson Excel Discussion (Misc queries) 1 June 21st 05 06:08 PM
Empty space in formulas. Arla M Excel Worksheet Functions 4 January 27th 05 06:35 AM


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