Results 1 to 5 of 5

Selecting multiple columns for reformatting

Threaded View

  1. #1
    Forum Contributor
    Join Date
    10-28-2009
    Location
    Portland, Maine
    MS-Off Ver
    Excel 2003
    Posts
    102

    Selecting multiple columns for reformatting

    I need a quicker and more efficient way of reformatting date columns. I put together the following code but it only allows me to specify a single column or continuous range.

    I would like to be able to quickly identify multiple columns that need to be reformatted.

    I would like to be able to input the column letters (a,b,d,e,f ect…) and have each of the respective columns selected for reformatting.

    Any ideas on how do to this would be greatly appreciated.
    Thanks!


    Sub DateFormat()
    
    Dim ActSheet As Worksheet
    Dim clm
    Dim frmt
        Set ActSheet = ActiveSheet
        clm = InputBox("What Column Do You Need to Reformat?", "Column Selection", "a")
        frmt = InputBox("Format?", "Format", "dd/mm/yy hhss")
    
        If clm = "<>""" Then
        ElseIf clm = "" Then
            MsgBox "Form was null.  Select range and try again"
        End If
        
        On Error GoTo Etrap
        
        Columns(clm).Select
            With Selection
            .NumberFormat = frmt
            End With
    
    Etrap:
        Beep
    
    End Sub
    Last edited by yunesm; 11-04-2010 at 05:42 PM.

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