Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Concatenate Non Blank Cells

Hi,

On Sheet1 I want to be able to enter a Value in Column A and another
Value in Column B and have them concatenate in Column C with a } in
between them. I only want this to happen when Column A is Not Blank. If
only Column A has a Value then the result would be ColumnAValue}

I know I can do this with :
=IF(A1="","",CONCATENATE(A1,"}",B1))
but I really want to be able to do this with VBA code instead of a
formula. How do I do this?

Thanks Jody

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Concatenate Non Blank Cells

Range("C1").FormulaR1C1 = _
"=IF(RC1="""","""",CONCATENATE(RC1,""}"",RC2)) "

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Concatenate Non Blank Cells


Soniya wrote:
Range("C1").FormulaR1C1 = _
"=IF(RC1="""","""",CONCATENATE(RC1,""}"",RC2)) "



hi ssjody

try this

Sub a()
Worksheets("Ark1").Activate
Dim colA As Double ' CHECK HOW MANNY ROWS IN COLUMNS A
Dim colB As Double ' CHECK HOW MANNY ROWS IN COLUMNS B
Dim Big As Double
Dim i As Double
colA = Cells(Rows.Count, "B").End(xlUp).Row
colB = Cells(Rows.Count, "B").End(xlUp).Row
If colA colB Then
Big = colA
Else
Big = colB
End If
For i = 1 To Big
If Range("A" & i) 0 Then

Range("C" & i) = Range("A" & i) & Range("B" & i)
End If
Next i
End Sub

Regards yngve

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Concatenate Non Blank Cells

Thanks yngve! That's exactly what I wanted.

Jody

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
Index/match - make blank cells return a blank value. diaare Excel Worksheet Functions 3 May 3rd 23 03:44 AM
Excel 2002: Return blank when VLOOKUP on blank cells Mr. Low Excel Discussion (Misc queries) 2 June 4th 09 05:12 PM
Maximum Number of Blank Cells between Non Blank Cells in a Range Mal Excel Worksheet Functions 5 November 3rd 07 08:21 AM
CONCATENATE problem with blank cells roger_home Excel Discussion (Misc queries) 1 August 17th 05 09:18 PM
COPY A CONCATENATE CELL TO BLANK CELL PUTTING IN THE NEXT BLANK C. QUEST41067 Excel Discussion (Misc queries) 1 January 15th 05 09:29 PM


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