Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-13-2011, 11:11 AM
rajpeter rajpeter is offline vbc code Windows XP vbc code Office 2003
Novice
vbc code
 
Join Date: Sep 2011
Posts: 6
rajpeter is on a distinguished road
Default vbc code


hi
this is the code i found out from the web
how to make
RAJ PETER SHOUld show Raj Peter

HTML Code:
Sub macro1()
 Dim firstName As String
    Dim lastName As String
    Dim n As Integer
    Dim rowNum As Integer
    Dim colNum As Integer
    rowNum = 1
    colNum = 1
    
    While Cells(rowNum, colNum).Value <> ""
        n = InStr(1, Cells(rowNum, colNum).Value, ",")
        lastName = Left(Cells(rowNum, colNum).Value, n - 1)
        firstName = Right(Cells(rowNum, colNum).Value, Len(Cells(rowNum, colNum).Value) - n - 1)
        Cells(rowNum, colNum + 1).Value = firstName
        Cells(rowNum, colNum + 2).Value = lastName
        rowNum = rowNum + 1
    Wend
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to add dates terricritch Excel Programming 10 11-08-2011 09:51 AM
vba code in excel rajpeter Excel Programming 5 09-11-2011 06:13 PM
vbc code Fastest way to run a code b0x4it Word VBA 4 05-18-2011 07:54 PM
FileSaveAs with Code bsmith Office 0 01-05-2006 08:43 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:52 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft