Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    552
    Thanks
    0
    Thanked 1 Time in 1 Post

    Delete numbers and replace with % (Excel xp)

    I have a csv file that i need to change the red cells into the blue cells. Basically, i need to search down the rows and take out the frequencies and replace them with the percentages(%). The red is the range i will search and the blue is the way i need it to turn out (on another worksheet, not on the same one). How would i do this in a loop in VBA? thank you for the help.

  2. #2
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Delete numbers and replace with % (Excel xp)

    This does it in place, so if you want to save the original data, you will have to copy it to another sheet. HTH --Sam
    <pre>Option Explicit
    Sub deleteFreq()
    Dim c As Range
    For Each c In ActiveSheet.UsedRange.Columns(1).Cells
    c.Select
    If c = "" Then
    If c.Offset(0, 1) <> "" And IsNumeric(c.Offset(0, 1)) Then
    c.Offset(0, 1).Copy c.Offset(-1, 1)
    c.EntireRow.Delete
    End If
    End If
    Next c
    End Sub</pre>

    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

Posting Permissions

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