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

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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