#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Convert

Hi

Thank you Frank and Bob for your help with the code below
to convert figures such as 1.6M and 0.25M into proper
numbers.

When ever i run the code below i get the
error 'Application defined or object defined error'

Does any know why this is happening?

TIA

Sub convert()

For x = 2 To Cells(Rows.Count, "L").End(xlUp).Row
Cells(i, "L").Value = Left(Cells(i, "L").Value, Len
(Cells(i, "L").Value) - 1) * 1000000
Next x

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Convert

Hi
some ideas:
1. the lines
Cells(i, "L").Value = Left(Cells(i, "L").Value, Len
(Cells(i, "L").Value) - 1) * 1000000
are actually ONE line

2. you may try if the above was not the cause of your error:
Cells(i, "L").Value = CDBL(Left(Cells(i, "L").Value, _
Len (Cells(i, "L").Value) - 1)) * 1000000



--
Regards
Frank Kabel
Frankfurt, Germany

Edgar wrote:
Hi

Thank you Frank and Bob for your help with the code below
to convert figures such as 1.6M and 0.25M into proper
numbers.

When ever i run the code below i get the
error 'Application defined or object defined error'

Does any know why this is happening?

TIA

Sub convert()

For x = 2 To Cells(Rows.Count, "L").End(xlUp).Row
Cells(i, "L").Value = Left(Cells(i, "L").Value, Len
(Cells(i, "L").Value) - 1) * 1000000
Next x

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Convert

Hi Edgar,

Tut tut!

You are using the variable x as your loop counter, but then you reference
the cells via the variable i, not x.

If you used Option Explicit at the start of the module, you would not get
away with this. You can make this automatic by going into ToolsOptionsEdit
and check the Require Variable Declaration box.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Edgar" wrote in message
...
Hi

Thank you Frank and Bob for your help with the code below
to convert figures such as 1.6M and 0.25M into proper
numbers.

When ever i run the code below i get the
error 'Application defined or object defined error'

Does any know why this is happening?

TIA

Sub convert()

For x = 2 To Cells(Rows.Count, "L").End(xlUp).Row
Cells(i, "L").Value = Left(Cells(i, "L").Value, Len
(Cells(i, "L").Value) - 1) * 1000000
Next x

End Sub



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
can the "convert" function in excel convert to UK gallons? JR Excel Discussion (Misc queries) 2 April 24th 08 04:55 PM
how will i convert 05.01.2007 convert 05.Jan.2007 format? lady_like New Users to Excel 17 February 9th 07 12:43 PM
convert value in word. For Exampe Rs.115.00 convert into word as . Shakti Excel Discussion (Misc queries) 1 May 10th 05 12:00 PM
convert decimal number to time : convert 1,59 (minutes, dec) to m agenda9533 Excel Discussion (Misc queries) 8 January 20th 05 10:24 PM
Convert Time...!convert tenths of a second Pape Excel Discussion (Misc queries) 2 December 16th 04 10:17 AM


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