Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel macro - truncate cell at X characters (left to right)

Need to create a macro to be able to truncate the contents of cells at X
characters. X will always be the same value. X will be counted left to
right

Ex. If X = 5
ABC1234 would be truncated to ABC12
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Excel macro - truncate cell at X characters (left to right)


sub ABC()
Dim x as Long, cell as Range
x = 5
for each cell in selection
cell.Value = left(cell.Value,x)
Next
end sub

--
Regards,
Tom Ogilvy


"E2goJJM" wrote:

Need to create a macro to be able to truncate the contents of cells at X
characters. X will always be the same value. X will be counted left to
right

Ex. If X = 5
ABC1234 would be truncated to ABC12

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
formula to truncate text characters MarkT Excel Discussion (Misc queries) 6 June 4th 09 04:19 PM
Trying to truncate or separate the first 3 characters/digits of co Jim Excel Discussion (Misc queries) 4 January 13th 06 01:51 PM
fill or truncate to a certain number of characters in a cell Jan Buckley Excel Worksheet Functions 1 March 16th 05 03:46 PM
linking cells in Excel 2003. How to not truncate to 255 characters. GarryFerg Excel Discussion (Misc queries) 5 December 8th 04 03:33 PM
Truncate last five characters Jesse Hamilton Excel Programming 9 November 11th 03 06:43 PM


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