Combining values problem

JonRowland

Active Member
Joined
May 9, 2003
Messages
417
Office Version
  1. 365
Platform
  1. Windows
Hi,
I have two variables declared as string and I am combining them using
</code>
Cells(lngrow, 27) = strSRowA & "," & strSRowB
</code>

So I have one cell as 1154 the second as 1155 I wish to combine as <b>1154,1155</b> but the value in the cell displays as 11,541,155 and is stored in the cell as 11541115.

What do I need to do to get the correct value stored & displayed in the cell?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Cells(lngrow, 27) = strSRowA + strSRowB / 1000
Cells(lngrow, 27).NumberFormat = "0.0000"
 
Upvote 0
Not what I wanted as formatted incorrectly and does stored what I want in the cell. But jogged my memory.

<code>
Cells(lngrow, 27).NumberFormat = "@"
Cells(lngrow, 27) = strSRowA & "," & strSRowB
</code>

Hey presto get what I want
Cheers
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,316
Members
452,634
Latest member
cpostell

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