A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

text column - via macro



 
 
Thread Tools Display Modes
  #1  
Old June 1st, 2010, 12:56 AM posted to microsoft.public.excel.newusers
ROHIT
external usenet poster
 
Posts: 36
Default text column - via macro

Hi
Can someone write a macro for me to text column with the folloing

eg in Column A, I have 4602101 - AAAAABBBBBBBCCCCCC
so, I want macro to separate as put 4602101 in column A and the text in
column B

  #2  
Old June 1st, 2010, 01:13 PM posted to microsoft.public.excel.newusers
Gary''s Student
external usenet poster
 
Posts: 7,584
Default text column - via macro

You can do this without macros, but try this:

Sub SplitUm()
Dim r1 As Range, r2 As Range
Set r1 = Intersect(ActiveSheet.UsedRange, Range("A:A"))
cutt = " - "
For Each r2 In r1
v = r2.Value
r2.Value = Split(v, cutt)(0)
r2.Offset(0, 1).Value = Split(v, cutt)(1)
Next
End Sub
--
Gary''s Student - gsnu201003


"Rohit" wrote:

Hi
Can someone write a macro for me to text column with the folloing

eg in Column A, I have 4602101 - AAAAABBBBBBBCCCCCC
so, I want macro to separate as put 4602101 in column A and the text in
column B

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:44 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.