expected end of statement require error

akkinarula

New Member
Joined
Sep 2, 2011
Messages
27
hi all ,
i m getting following error while concatinating following string which i m taking from mstr1 and mstr2 .a is the variable which takes value from loop.

mstr1 = "'Customer''s Details'!R" & Trim(Str(a)) & "C39"
mstr2 = "'Customer''s Details'!R" & Trim(Str(a)) & "C43"
str1 = "=(CONCATENATE (" & mstr1 " & mstr2")"


plz tell me where i m missing something.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Maybe:
mstr1 = "'Customer''s Details'!R" & Trim(Str(a)) & "C39"
mstr2 = "'Customer''s Details'!R" & Trim(Str(a)) & "C43"
str1 = "=(CONCATENATE (" & mstr1 & mstr2 & ")"

But I am curious. Do you really have two apostrophe's where indicated?
 
Upvote 0
I dont think you need to use CONCATENATE here as it gives exactly the same results as "&"

What is the value you are trying to get for str1? If it is MSTR1 and MSTR2 separated by a space this will do it:

MSTR1&" "&MSTR2

But I think what you are trying to do is to join the values from the references given so what I think you need is:

str1 = Range(mstr1).Value & " " & Range(mstr2).Value

(You can actually omit the Value bit as the property is assumed to be Value by default unless you define it as something else)

If you want to preserve the format of the two values (say one contains $12.30 (formatted as currency) and the other Overdrawn (text) you want it to display as $12.30 Overdrawn and not 12.3 Overdrawn) use Text instead of Value in the above line.

But I am not entirely convinced your references work - have you tried spitting out MSTR1 and MSTR2 using message boxes to check that the syntax is coming out correctly?
 
Upvote 0
I dont think you need to use CONCATENATE here as it gives exactly the same results as "&"

What is the value you are trying to get for str1? If it is MSTR1 and MSTR2 separated by a space this will do it:

MSTR1&" "&MSTR2

But I think what you are trying to do is to join the values from the references given so what I think you need is:

str1 = Range(mstr1).Value & " " & Range(mstr2).Value

(You can actually omit the Value bit as the property is assumed to be Value by default unless you define it as something else)

If you want to preserve the format of the two values (say one contains $12.30 (formatted as currency) and the other Overdrawn (text) you want it to display as $12.30 Overdrawn and not 12.3 Overdrawn) use Text instead of Value in the above line.

But I am not entirely convinced your references work - have you tried spitting out MSTR1 and MSTR2 using message boxes to check that the syntax is coming out correctly?



it worked as i tried following way

mstr1 = "'Customer''s Details'!R" & Trim(Str(a)) & "C39"
mstr2 = "'Customer''s Details'!R" & Trim(Str(a)) & "C43"
str1 = "=CONCATENATE(" & mstr1 & ","" "" " & "," & mstr2 & ")"
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top