+ Reply to Thread
Results 1 to 7 of 7

Add "%" sign to every other column in a range

  1. #1
    Registered User
    Join Date
    05-22-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    11

    Add "%" sign to every other column in a range

    I have a CSV file that after being imported into excel does not add a "%" sign to values in every other column beginning with row 3 and column 3. Each file can have a varying number of columns and rows (changes should always start at row 3). I am able to add the percent sign with the code below; however, it adds the % sign to every column rather than every other column. Any suggestions on add the % sign to every other column? I'm using excel 2010 if that makes a difference.

    Sub Percent()
    Application.ScreenUpdating = False
    For Each col In Application.ActiveSheet.Columns
    If col.Column Mod 2 = 0 Then
    Range("C3", "DC100").Select
    Selection.NumberFormat = "0""%"""

    End If
    Next col
    Application.ScreenUpdating = True
    End Sub

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Add "%" sign to every other column in a range

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Add "%" sign to every other column in a range

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    05-22-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Add "%" sign to every other column in a range

    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe:

    Please Login or Register  to view this content.
    John, thank you, this code works for columns beginning with column "D". I changed the line

    lc = ActiveSheet.UsedRange.Columns.Count + 2
    to
    lc = ActiveSheet.UsedRange.Columns.Count + 1

    code works perfectly beginning with column "C".

    Thanks!

  5. #5
    Registered User
    Join Date
    05-22-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Add "%" sign to every other column in a range

    Quote Originally Posted by shg View Post
    Please Login or Register  to view this content.
    Thank you shg,

    This code works well, any way to remove the 0% from the blank cells?

    Thank you!

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Add "%" sign to every other column in a range

    Dunno. Maybe

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    05-22-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Add "%" sign to every other column in a range

    Thank you, I will try that.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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