Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Formatting Data Pasted from Web Based Table for Summation

I have cut data out of a web based table and pasted into excel. I then try
to sum a column of this data but it will not sum. I checked the text format
and their don't seem to be any issues. Note that I can cut this data from
the web page and paste into word, then copy from word and "paste special"
into excel and then summing works. I'm trying to aviod these intermediate
steps. Your help would be appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 427
Default Formatting Data Pasted from Web Based Table for Summation

I notice when I copy and paste from a website into Excel that a lot of
"overhead" from the website carries over into Excel: colors, fonts,
spaces, tabs, etc. Even if your cell is formatted as a number if the
figure comes from the web page as a text string Excel will still treat
it as text. A leading apostrophe, leading or trailing space, even
sometimes a $ sign will cause Excel to interpret the string as text.

Try this macro on a backed up copy of your file. Highlight the range
of values in question and run this code; it copies the formula value
into memory, deletes it, reformats the cell as Number format with a
comma and two decimal places, then re-writes the value into the cell.
If any text entries persist they will be left-justified in the cell,
and you'll see they need additional attention; numeric entries will be
right-justified.

Sub Selected_Range_Format()
Dim rCell As Range
Dim TrueVal As Variant

For Each rCell In Selection.Cells
TrueVal = Trim(rCell.Value)
rCell.ClearContents
rCell.HorizontalAlignment = xlGeneral
rCell.NumberFormat = "#,##0.00"
rCell.Value = TrueVal
Next rCell

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
Deleting data in a table from excel export Secret Squirrel Excel Discussion (Misc queries) 0 February 9th 06 02:21 AM
Help! data from pasted table is not included in sum campli Excel Worksheet Functions 5 January 12th 06 08:54 PM
Inserting a new line when external data changes Rental Man Excel Discussion (Misc queries) 0 January 11th 06 07:05 PM
Conditional formatting in a data table TimR Excel Discussion (Misc queries) 0 October 5th 05 07:28 PM
Change Data In Pivot Table John Calder New Users to Excel 1 July 7th 05 10:41 PM


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