Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default find...insert

Hemu, try this:

Sub thousands()
Dim rng As Range, c As Range
Dim LRow As Long

LRow = Cells(Rows.Count, 1).End(xlUp).Row
Set rng = Worksheets("Sheet1").Range("A1:A" & LRow)

For Each c In rng
If InStr(1, c.Value, ".") = 0 Then
c.Value = c.Value / 1000
c.NumberFormat = "0.000"
End If
Next
End Sub

Mike F
"Hemant_india" wrote in message
...
thanx nigel
i want to put ur code in a loop
and want to check whether "." already exist in string
how do i do that
actually i'm importing a sequentil thru import wizard...with fixed width
--
hemu


"Nigel" wrote:

Inserting an additional character into a string can be achieved by
splitting
the string into two and re-combine with the additional(s) required

in its simplest form.......

stOriginal = "123000"
stResult = Left(stOriginal,3) & "." & Right(stOriginal,3)

if it will be numerical then you could just divide the value by 1000 -
but
your local settings may insert something other than a decimal point!



--
Cheers
Nigel



"Hemant_india" wrote in message
...
hi
i want to add "." in "123000" as a decimal point
if it is not already there
how to do this?
--
hemu






  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default find...insert

The last code failed a test, try this modification:

Sub thousands()
Dim rng As Range, c As Range
Dim LRow As Long

LRow = Cells(Rows.Count, 1).End(xlUp).Row
Set rng = Worksheets("Sheet1").Range("A1:A" & LRow)

For Each c In rng
If InStr(1, c.Text, ".") = 0 Then
c.Value = c.Value / 1000
c.NumberFormat = "0.000"
End If
Next
End Sub

Mike F
"Mike Fogleman" wrote in message
m...
Hemu, try this:

Sub thousands()
Dim rng As Range, c As Range
Dim LRow As Long

LRow = Cells(Rows.Count, 1).End(xlUp).Row
Set rng = Worksheets("Sheet1").Range("A1:A" & LRow)

For Each c In rng
If InStr(1, c.Value, ".") = 0 Then
c.Value = c.Value / 1000
c.NumberFormat = "0.000"
End If
Next
End Sub

Mike F
"Hemant_india" wrote in message
...
thanx nigel
i want to put ur code in a loop
and want to check whether "." already exist in string
how do i do that
actually i'm importing a sequentil thru import wizard...with fixed width
--
hemu


"Nigel" wrote:

Inserting an additional character into a string can be achieved by
splitting
the string into two and re-combine with the additional(s) required

in its simplest form.......

stOriginal = "123000"
stResult = Left(stOriginal,3) & "." & Right(stOriginal,3)

if it will be numerical then you could just divide the value by 1000 -
but
your local settings may insert something other than a decimal point!



--
Cheers
Nigel



"Hemant_india" wrote in message
...
hi
i want to add "." in "123000" as a decimal point
if it is not already there
how to do this?
--
hemu







  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default find...insert

thanx mike
thanx a lot
--
hemu


"Mike Fogleman" wrote:

The last code failed a test, try this modification:

Sub thousands()
Dim rng As Range, c As Range
Dim LRow As Long

LRow = Cells(Rows.Count, 1).End(xlUp).Row
Set rng = Worksheets("Sheet1").Range("A1:A" & LRow)

For Each c In rng
If InStr(1, c.Text, ".") = 0 Then
c.Value = c.Value / 1000
c.NumberFormat = "0.000"
End If
Next
End Sub

Mike F
"Mike Fogleman" wrote in message
m...
Hemu, try this:

Sub thousands()
Dim rng As Range, c As Range
Dim LRow As Long

LRow = Cells(Rows.Count, 1).End(xlUp).Row
Set rng = Worksheets("Sheet1").Range("A1:A" & LRow)

For Each c In rng
If InStr(1, c.Value, ".") = 0 Then
c.Value = c.Value / 1000
c.NumberFormat = "0.000"
End If
Next
End Sub

Mike F
"Hemant_india" wrote in message
...
thanx nigel
i want to put ur code in a loop
and want to check whether "." already exist in string
how do i do that
actually i'm importing a sequentil thru import wizard...with fixed width
--
hemu


"Nigel" wrote:

Inserting an additional character into a string can be achieved by
splitting
the string into two and re-combine with the additional(s) required

in its simplest form.......

stOriginal = "123000"
stResult = Left(stOriginal,3) & "." & Right(stOriginal,3)

if it will be numerical then you could just divide the value by 1000 -
but
your local settings may insert something other than a decimal point!



--
Cheers
Nigel



"Hemant_india" wrote in message
...
hi
i want to add "." in "123000" as a decimal point
if it is not already there
how to do this?
--
hemu








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
find name and insert address JL Excel Worksheet Functions 3 May 9th 07 05:25 AM
Find and insert? leonidas[_64_] Excel Programming 6 August 4th 06 10:04 AM
Find & Insert - Is this possible?? xhgroup Excel Discussion (Misc queries) 2 March 18th 06 05:31 AM
How do I find a value and insert new value SingaporeSling Excel Worksheet Functions 4 February 4th 05 06:03 AM
find row value, insert column gaba Excel Programming 0 October 18th 04 06:59 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"