+ Reply to Thread
Results 1 to 5 of 5

Select a specific column till it identifies blank cell and to format

  1. #1
    Registered User
    Join Date
    04-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007/2010
    Posts
    3

    Select a specific column till it identifies blank cell and to format

    Hi Guys,
    Am new to this forum.

    Its my first post. Kindly help me out.

    I need to select the column with complete or partial name known and to format it to 'text' or 'currency'.. How can i write a macro for this ?

    Below code works to some extent.. but need not select and format complete column, need it only to do till null cells are identified..
    Also mentioned the details of formatting i need in the attachment.. Thanks a lot guys !!

    Sub Macro3()
    Dim i As Integer, cfindmacro As Range
    Set cfindmacro = ActiveSheet.UsedRange.Cells.Find(what:="name", lookat:=xlWhole)
    i = cfindmacro.Column
    Columns(i).NumberFormat = "000-000-000"
    Set cfindmacro = ActiveSheet.UsedRange.Cells.Find(what:="salary", lookat:=xlWhole)
    i = cfindmacro.Column
    Columns(i).NumberFormat = "$000,000,00#.00"
    End Sub
    Attached Files Attached Files

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,310

    Re: Select a specific column till it identifies blank cell and to format

    Possibly something along the lines of...
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007/2010
    Posts
    3

    Re: Select a specific column till it identifies blank cell and to format

    Hi Dande, thanx for the answer.. but I need to iterate this to complete work sheet, not the first occurence alone.. pls check the attached sheet, scroll it n see plz..

  4. #4
    Registered User
    Join Date
    04-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007/2010
    Posts
    3

    Re: Select a specific column till it identifies blank cell and to format

    With Cells.SpecialCells(xlCellTypeConstants, 23)
    Set Cell = .Find("emp_name")
    Range(Cell.Offset(1, 0), Cell.End(xlDown)).NumberFormat = "@"
    End With

    I need to iterate the above process / need this process to being from the cell i select !

  5. #5
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,310

    Re: Select a specific column till it identifies blank cell and to format

    Try...
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1