Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Exchanging text between two cells

I am trying to flip text between two cells:

Dim strTemp As String

strTemp = Cells(nCurrent, 1).Value
Cells(nCurrent, 1).Value = Cells(nCurrent + 1, 1).Value
Cells(nCurrent + 1, 1).Value = strTemp

If I start with "3.100" and "3.10" in the two cells, I end up with 3.1 in
both cells after this code is executed.

Any help is appreciated
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default Exchanging text between two cells

Apply the same number format (eg 0.00) to both cells

HTH
--
AP

"cherij" a écrit dans le message de
...
I am trying to flip text between two cells:

Dim strTemp As String

strTemp = Cells(nCurrent, 1).Value
Cells(nCurrent, 1).Value = Cells(nCurrent + 1, 1).Value
Cells(nCurrent + 1, 1).Value = strTemp

If I start with "3.100" and "3.10" in the two cells, I end up with 3.1 in
both cells after this code is executed.

Any help is appreciated



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Exchanging text between two cells

Make sure the cells are formatted as TEXT as you save the data into a string.
Or reformat as number e.g. Cells(nCurrent, 1)..NumberFormat = "0.000"

HTH

"cherij" wrote:

I am trying to flip text between two cells:




Dim strTemp As String

strTemp = Cells(nCurrent, 1).Value
Cells(nCurrent, 1).Value = Cells(nCurrent + 1, 1).Value
Cells(nCurrent + 1, 1).Value = strTemp

If I start with "3.100" and "3.10" in the two cells, I end up with 3.1 in
both cells after this code is executed.

Any help is appreciated

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Exchanging text between two cells

Should be:

Cells(nCurrent, 1).NumberFormat = "0.000"


"Toppers" wrote:

Make sure the cells are formatted as TEXT as you save the data into a string.
Or reformat as number e.g. Cells(nCurrent, 1)..NumberFormat = "0.000"

HTH

"cherij" wrote:

I am trying to flip text between two cells:




Dim strTemp As String

strTemp = Cells(nCurrent, 1).Value
Cells(nCurrent, 1).Value = Cells(nCurrent + 1, 1).Value
Cells(nCurrent + 1, 1).Value = strTemp

If I start with "3.100" and "3.10" in the two cells, I end up with 3.1 in
both cells after this code is executed.

Any help is appreciated

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Exchanging text between two cells

I am trying to preserve the value in the cell as a text value. If I use
number formatting (and set it to 0.000) what happens if I get an entry for
3.1000?


"Toppers" wrote:

Should be:

Cells(nCurrent, 1).NumberFormat = "0.000"


"Toppers" wrote:

Make sure the cells are formatted as TEXT as you save the data into a string.
Or reformat as number e.g. Cells(nCurrent, 1)..NumberFormat = "0.000"

HTH

"cherij" wrote:

I am trying to flip text between two cells:




Dim strTemp As String

strTemp = Cells(nCurrent, 1).Value
Cells(nCurrent, 1).Value = Cells(nCurrent + 1, 1).Value
Cells(nCurrent + 1, 1).Value = strTemp

If I start with "3.100" and "3.10" in the two cells, I end up with 3.1 in
both cells after this code is executed.

Any help is appreciated



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
Exchanging information BBS0 Excel Worksheet Functions 2 December 2nd 08 03:38 AM
exchanging rows nada Excel Worksheet Functions 1 February 27th 08 01:53 PM
exchanging values amoung sheets havey Excel Worksheet Functions 4 February 25th 06 04:05 AM
exchanging X and Y in a plot Bruce Bowler Excel Programming 3 August 5th 05 02:33 PM
Exchanging data between Linux and Excel Kiwi Trader Guy Excel Programming 1 June 12th 05 12:45 PM


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