Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default how to reverse cells value

How to the number that seperate with commas e.g. 11,22,33,44 to become
44,33,22,11 using formula functions?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default how to reverse cells value

Public Function RevStr(Rng As Range)
If IsNumeric(Rng) Then
RevStr = StrReverse(Rng.Text) + 0
Else
RevStr = StrReverse(Rng.Text)
End If
End Function


Gord Dibben Excel MVP

On Sat, 24 Dec 2005 05:30:00 +0800, "Jaemun" <x wrote:

How to the number that seperate with commas e.g. 11,22,33,44 to become
44,33,22,11 using formula functions?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default how to reverse cells value

Cool!

That was what I'm talking about (user define functions). But I want it
exactly the same.as what it have in the cell without removing the commas.

Thanks in advance.

Jaemun,

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Public Function RevStr(Rng As Range)
If IsNumeric(Rng) Then
RevStr = StrReverse(Rng.Text) + 0
Else
RevStr = StrReverse(Rng.Text)
End If
End Function


Gord Dibben Excel MVP

On Sat, 24 Dec 2005 05:30:00 +0800, "Jaemun" <x wrote:

How to the number that seperate with commas e.g. 11,22,33,44 to become
44,33,22,11 using formula functions?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default how to reverse cells value

Do you want a number or text returned?

You originally stated "number" so I assumed it was a custom formatted number
which you would re-format after reversing.

Is 11,22,33,44 a custom formatted number or is it text that Excel thinks is a
number?

This will return 11,22,33,44 as 44,33,22,11 but as text.

Public Function RevStr(Rng As Range)
RevStr = StrReverse(Rng.text)
End Function


Gord

On Sat, 24 Dec 2005 06:13:07 +0800, "Jaemun" <x wrote:

Cool!

That was what I'm talking about (user define functions). But I want it
exactly the same.as what it have in the cell without removing the commas.

Thanks in advance.

Jaemun,

"Gord Dibben" <gorddibbATshawDOTca wrote in message
.. .
Public Function RevStr(Rng As Range)
If IsNumeric(Rng) Then
RevStr = StrReverse(Rng.Text) + 0
Else
RevStr = StrReverse(Rng.Text)
End If
End Function


Gord Dibben Excel MVP

On Sat, 24 Dec 2005 05:30:00 +0800, "Jaemun" <x wrote:

How to the number that seperate with commas e.g. 11,22,33,44 to become
44,33,22,11 using formula functions?


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default how to reverse cells value

BullsEye!!!
Excellent!

That was great. I thank you more than I can say:)

Jaemun.

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Do you want a number or text returned?

You originally stated "number" so I assumed it was a custom formatted

number
which you would re-format after reversing.

Is 11,22,33,44 a custom formatted number or is it text that Excel thinks

is a
number?

This will return 11,22,33,44 as 44,33,22,11 but as text.

Public Function RevStr(Rng As Range)
RevStr = StrReverse(Rng.text)
End Function


Gord

On Sat, 24 Dec 2005 06:13:07 +0800, "Jaemun" <x wrote:

Cool!

That was what I'm talking about (user define functions). But I want it
exactly the same.as what it have in the cell without removing the commas.

Thanks in advance.

Jaemun,

"Gord Dibben" <gorddibbATshawDOTca wrote in message
.. .
Public Function RevStr(Rng As Range)
If IsNumeric(Rng) Then
RevStr = StrReverse(Rng.Text) + 0
Else
RevStr = StrReverse(Rng.Text)
End If
End Function


Gord Dibben Excel MVP

On Sat, 24 Dec 2005 05:30:00 +0800, "Jaemun" <x wrote:

How to the number that seperate with commas e.g. 11,22,33,44 to become
44,33,22,11 using formula functions?






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default how to reverse cells value

knew there was strreverse function as gord described, but wanted to try some
convoluted approach to see what happend. i am sure someone can come up with
something else.

here is a macro that works here when the values are in column A if you run
it twice, it should put them back in the original order


Sub reverse()
Dim lastrow As Long
Dim rng As Range
Dim cell As Range
Dim r As Integer
r = 1
lastrow = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row

For Each cell In Range("A1:A" & lastrow)
Set rng = Range("a" & r)
i = 1
l = Len(rng)
temp = cell
For i = 1 To Len(rng) - 1 Step 1
temp = temp & Mid(rng, l - i, 1)
Next
rng.Value = Mid(temp, l, l)
r = r + 1
Next
End Sub


--


Gary


"Jaemun" <x wrote in message
...
How to the number that seperate with commas e.g. 11,22,33,44 to become
44,33,22,11 using formula functions?




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default how to reverse cells value

Hi Gary,

Actually, I'm preffered functions very much right now. Anyway, thank and my
appreciate for your help. And I could used that stuff too in my next work:)

Jaemun.


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
knew there was strreverse function as gord described, but wanted to try

some
convoluted approach to see what happend. i am sure someone can come up

with
something else.

here is a macro that works here when the values are in column A if you run
it twice, it should put them back in the original order


Sub reverse()
Dim lastrow As Long
Dim rng As Range
Dim cell As Range
Dim r As Integer
r = 1
lastrow = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row

For Each cell In Range("A1:A" & lastrow)
Set rng = Range("a" & r)
i = 1
l = Len(rng)
temp = cell
For i = 1 To Len(rng) - 1 Step 1
temp = temp & Mid(rng, l - i, 1)
Next
rng.Value = Mid(temp, l, l)
r = r + 1
Next
End Sub


--


Gary


"Jaemun" <x wrote in message
...
How to the number that seperate with commas e.g. 11,22,33,44 to become
44,33,22,11 using formula functions?






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
count total cells if they are a certain color-reverse conditional Grams Excel Worksheet Functions 1 March 5th 10 06:39 PM
Reverse string on multiply cells Amnon Wilensky Excel Worksheet Functions 3 February 26th 10 01:14 AM
In Excel - reverse the sign on a range of numeric cells MaryKaye Excel Discussion (Misc queries) 3 February 18th 10 07:33 PM
Can I reverse the order of data in a set of cells? salwitt Excel Discussion (Misc queries) 3 October 24th 05 11:14 PM
can i reverse the data of cells? Anney Excel Programming 2 March 22nd 05 08:17 AM


All times are GMT +1. The time now is 02:08 AM.

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"