Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Converting Text to Numbers

I have a spreadsheet that is exported from Quickbooks (QB). I have added a
custom field in QB to enter a cost for a line item on an invoice. The
problem is that this is only a text field and QB does not perform any
calculations on it. So...
I have decided to export it to an existing spreadsheet in excel and run a
macro against it.

I recorded a macro and in the process I selected the range of "text numbers"
using the Shift+End+Down Arrow combination. Then I click the error box and
select convert text to numbers. The fields change in excel but the macro
doesn't capture it. Can this be done?

Basically I want to take a selected range and convert the numbers that are
stored as text to an actual number so I can perform calculations against
them.


Any help is appreciated

Thanks

Charlie


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Converting Text to Numbers

Sub ConverttoNumbers()
Dim cell as Range
for each cell in selection
if isnumeric(trim(cell)) then
cell.numberformat = "General"
cell.Value = 1*Trim(cell.value)
end if
Next
End if

you can also put 1 in and empty cell, copy it, select the cells and do
edit=Paste Special and Select multiply

format the cell to general before you do it.

--
Regards,
Tom Ogilvy



"Charles May" wrote:

I have a spreadsheet that is exported from Quickbooks (QB). I have added a
custom field in QB to enter a cost for a line item on an invoice. The
problem is that this is only a text field and QB does not perform any
calculations on it. So...
I have decided to export it to an existing spreadsheet in excel and run a
macro against it.

I recorded a macro and in the process I selected the range of "text numbers"
using the Shift+End+Down Arrow combination. Then I click the error box and
select convert text to numbers. The fields change in excel but the macro
doesn't capture it. Can this be done?

Basically I want to take a selected range and convert the numbers that are
stored as text to an actual number so I can perform calculations against
them.


Any help is appreciated

Thanks

Charlie



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Converting Text to Numbers

If your data is in a single column, you could record a macro when you do:

Data|Text to columns
and click Finish.



Charles May wrote:

I have a spreadsheet that is exported from Quickbooks (QB). I have added a
custom field in QB to enter a cost for a line item on an invoice. The
problem is that this is only a text field and QB does not perform any
calculations on it. So...
I have decided to export it to an existing spreadsheet in excel and run a
macro against it.

I recorded a macro and in the process I selected the range of "text numbers"
using the Shift+End+Down Arrow combination. Then I click the error box and
select convert text to numbers. The fields change in excel but the macro
doesn't capture it. Can this be done?

Basically I want to take a selected range and convert the numbers that are
stored as text to an actual number so I can perform calculations against
them.

Any help is appreciated

Thanks

Charlie


--

Dave Peterson
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
Converting text to numbers Ron Coderre Excel Programming 2 October 21st 06 11:10 PM
converting numbers to text gls858 New Users to Excel 2 October 18th 05 10:56 PM
Converting numbers formatted as text to numbers Bill Excel Discussion (Misc queries) 1 July 19th 05 07:10 PM
about converting numbers to text. Ahmad Al-Nahar Excel Discussion (Misc queries) 5 July 14th 05 01:24 AM
converting numbers to text and prefill text field with 0's Jan Buckley Excel Discussion (Misc queries) 2 January 20th 05 09:03 PM


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