Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default breaking a cell into two cells via VBA program

Hi Jordan,

In Tom's SplitValues Sub, which I prefer to my suggestion, there is a small
typo in the line:

cell.offset(0,1).Value = Right(sStr,len(sStr)-1)


which should read:

cell.offset(0,1).Value = Right(sStr,len(sStr)-2)

---
Regards,
Norman


"Tom Ogilvy" wrote in message
...
Sub SplitValues()
Dim sStr as String, rng as Range
set rng = Range("A1:A2000")
for each cell in rng
sStr = Trim(Cell.Value)
if sStr < "" then
Cell.Value = "'" & Left(sStr,2)
cell.offset(0,1).Value = Right(sStr,len(sStr)-1)
end if
Next
End sub

--
Regards,
Tom Ogilvy



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
modify linked cells without breaking link JK Excel Discussion (Misc queries) 1 December 23rd 09 06:45 PM
split text in one cell into multiple cells without breaking the wo Prashant Excel Worksheet Functions 3 March 6th 06 08:48 AM
breaking text in one cell into two cells Polina Excel Discussion (Misc queries) 3 May 24th 05 11:07 PM
Breaking a Cell Santosh Budalakoti Excel Worksheet Functions 1 December 28th 04 05:58 AM
Breaking a word by each alphabet and inputing it in different cells Sandip Shah Excel Programming 1 July 18th 03 06:19 AM


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