hi, use this code in Worksheet_Change
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 2 Then Target.Value = Left(Target.Value, 25) End If End Sub Regards bala On Jun 1, 2:44 pm, manish gupta <mkg.necess...@gmail.com> wrote: > Hi Bala, > Thank you for helping me in this matter,it is working fine...however i need > further help > > as in attached sheet "LOCNAME" in this field i want to retain only 25 > character from left..can u modify the code once again > > thanks in advance. > > manish kumar gupta > > > > On Mon, Jun 1, 2009 at 12:40 PM, bala <bal...@gmail.com> wrote: > > > Hi, > > > Try this code > > > Sub Test() > > Range("A2").Select > > While ActiveCell.Value <> "" > > ' For ZIP > > If ActiveCell.Offset(0, 5).Value = "" Then > > ActiveCell.Offset(0, 5).Value = 99999 > > End If > > ' For B > > If ActiveCell.Offset(0, 6).Value = "" Then > > ActiveCell.Offset(0, 6).Value = 0 > > End If > > ' For C > > If ActiveCell.Offset(0, 7).Value = "" Then > > ActiveCell.Offset(0, 7).Value = 0 > > End If > > ' For BI > > If ActiveCell.Offset(0, 8).Value = "" Then > > ActiveCell.Offset(0, 8).Value = 0 > > End If > > ' For TIV > > If ActiveCell.Offset(0, 9).Value = "" Then > > ActiveCell.Offset(0, 9).Value = 0 > > End If > > ' For CONST > > If ActiveCell.Offset(0, 10).Value = "" Then > > ActiveCell.Offset(0, 10).Value = 0 > > End If > > ' For YEAR > > If ActiveCell.Offset(0, 11).Value = "" Then > > ActiveCell.Offset(0, 11).Value = 9999 > > End If > > ' For FL > > If ActiveCell.Offset(0, 12).Value = "" Then > > ActiveCell.Offset(0, 12).Value = 0 > > End If > > ' For OCC > > If ActiveCell.Offset(0, 13).Value = "" Then > > ActiveCell.Offset(0, 13).Value = 0 > > End If > > ' For SQFT > > If ActiveCell.Offset(0, 14).Value = "" Then > > ActiveCell.Offset(0, 14).Value = 0 > > End If > > ' For COUNTRY > > If ActiveCell.Offset(0, 17).Value = "" Then > > ActiveCell.Offset(0, 17).Value = "USA" > > End If > > ActiveCell.Offset(1, 0).Select > > Wend > > End Sub > > > Regards > > Bala > > > On May 29, 4:35 pm, manish gupta <mkg.necess...@gmail.com> wrote: > > > hi all, > > > > I need a help to fill the blank cell in attached excel sheet with certain > > > criteria as below- > > > > Field Name Acction Taken ZIP If blank fill with 99999 B If blank fill > > with 0 > > > C If blank fill with 0 BI If blank fill with 0 TIV If blank fill with 0 > > > CONST If blank fill with 0 YR If blank fill with 9999 FL If blank fill > > with > > > 0 OCC If blank fill with 0 SQFT If blank fill with 0 COUNTRY If blank > > fill > > > with USA > > > > I can do it manually but due to more file .i want any shortcut or Micros > > . > > > > can anyone help me regarding this. > > > > thanks in advance. > > > > Input Template Sample NEW_19_test.xls > > > 79KViewDownload > > > > Input Template Sample NEW_19_test.xls > 47KViewDownload- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---