Re: IF statement to check if it is a number or word




"Simon Luk" <simon.luk@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:gd3ui2$55i$1@xxxxxxxxxxxxxxxxxxxxx
Paul and Walter,

Thank you for your replies, one more problem I just came across..

['start_',a(1),'_end']

ans =

'start_' '1' '_end'


I want my ans to be actually this...

ans =

'start_1_end'

How would I go about doing that?

Since your a is a cell array you should index into it using curly braces
[like a{1}] to extract the contents of the first cell rather than extracting
the first cell itself for this application. When you concatenate a string,
a cell, and a string the result is a cell array with three cells -- the
first and third contain the two strings involved in your concatenation and
the second is the cell that was in the middle of your concatenation. That's
what your ans was. When you use a{1} instead of a(1), you're concatenating
together three strings (aka three char arrays) and the result is a
string/char array.

--
Steve Lord
slord@xxxxxxxxxxxxx


.



Relevant Pages

  • Re: Semicolon problem
    ... Dim sStr As String ... For Each cell In Selection ... If ans = vbYes Then ... > Sorry guys, when i created the thread i wanted to make the wrong> semicolon BOLD, but instead it added a * at both sides of the ...
    (microsoft.public.excel.programming)
  • Re: Help needed with CONCATENATE Function.
    ... then in F1 type the cell where you want the big concatenation to be..... ... Dim strConcat As String ...
    (microsoft.public.excel)
  • Re: Help needed with CONCATENATE Function.
    ... then in F1 type the cell where you want the big concatenation to be..... ... Dim strConcat As String ...
    (microsoft.public.excel)
  • Re: Create macro
    ... I realized I had to make change to the After string ... Rather than editing macro below to change ... Dim ans ... Dim cell As Range ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Inserting data into Chart Heading
    ... concatenation to create the title text you want (concatenate is what ... you could compile the heading you want into a single string as ... formula in a cell in the worksheet, again using concatenation, eg ...
    (microsoft.public.excel.charting)