Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default formatting cells loop

I have some numbers in column G that are formatted as general but newly
pasted text into the column doesnt seem to pick up the destination
formatting, even after formatting the selection. (I know this because
it distinguishes between it in a pivot table). It seems I need to go
through each cell and double click at the end of the text. Is there are
way to do this programatically? I figured if I recorded a macro doing
it in one cell then amending the code to go through the column? I've
never used a loop before so would appreciate any advice. The range of
cells is called SPECIALTY. TIA -Ciara

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default formatting cells loop

Select the cells to process, then run the macro.

Sub correctData()
for each cell in Select
cell.Numberformat = "General"
cell.Value = Replace(Trim(cell.Value),chr(160),"")
Next
End sub

--
Regards,
Tom Ogilvy


"Ciara" wrote:

I have some numbers in column G that are formatted as general but newly
pasted text into the column doesnt seem to pick up the destination
formatting, even after formatting the selection. (I know this because
it distinguishes between it in a pivot table). It seems I need to go
through each cell and double click at the end of the text. Is there are
way to do this programatically? I figured if I recorded a macro doing
it in one cell then amending the code to go through the column? I've
never used a loop before so would appreciate any advice. The range of
cells is called SPECIALTY. TIA -Ciara


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default formatting cells loop

this worked perfectly...
I changed "SELECT" to "Selection" as I think SELECT is one of the
reserved words... anyway it worked. Thanks Tom
Tom Ogilvy wrote:
Select the cells to process, then run the macro.

Sub correctData()
for each cell in Select
cell.Numberformat = "General"
cell.Value = Replace(Trim(cell.Value),chr(160),"")
Next
End sub

--
Regards,
Tom Ogilvy


"Ciara" wrote:

I have some numbers in column G that are formatted as general but newly
pasted text into the column doesnt seem to pick up the destination
formatting, even after formatting the selection. (I know this because
it distinguishes between it in a pivot table). It seems I need to go
through each cell and double click at the end of the text. Is there are
way to do this programatically? I figured if I recorded a macro doing
it in one cell then amending the code to go through the column? I've
never used a loop before so would appreciate any advice. The range of
cells is called SPECIALTY. TIA -Ciara



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default formatting cells loop

Yes, it should have been selection. My typo. Glad you were able to move it
to a solution.

--
Regards,
Tom Ogilvy


"Ciara" wrote:

this worked perfectly...
I changed "SELECT" to "Selection" as I think SELECT is one of the
reserved words... anyway it worked. Thanks Tom
Tom Ogilvy wrote:
Select the cells to process, then run the macro.

Sub correctData()
for each cell in Select
cell.Numberformat = "General"
cell.Value = Replace(Trim(cell.Value),chr(160),"")
Next
End sub

--
Regards,
Tom Ogilvy


"Ciara" wrote:

I have some numbers in column G that are formatted as general but newly
pasted text into the column doesnt seem to pick up the destination
formatting, even after formatting the selection. (I know this because
it distinguishes between it in a pivot table). It seems I need to go
through each cell and double click at the end of the text. Is there are
way to do this programatically? I figured if I recorded a macro doing
it in one cell then amending the code to go through the column? I've
never used a loop before so would appreciate any advice. The range of
cells is called SPECIALTY. TIA -Ciara




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
formatting cells loop Ciara Excel Programming 0 September 12th 06 12:10 PM
Conditional Formatting in For:Next loop - won't work!!! Cumberland[_3_] Excel Programming 3 June 21st 06 01:03 PM
Conditional Formatting in a Loop lost!! Excel Programming 8 October 6th 04 02:43 PM
conditional formatting & a loop lost!! Excel Programming 1 September 27th 04 08:59 PM
Loop for changing cell formatting Matt Excel Programming 1 January 15th 04 03:47 PM


All times are GMT +1. The time now is 09:03 PM.

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"