Consulting

Results 1 to 5 of 5

Thread: Copy and Paste Problem

  1. #1

    Copy and Paste Problem

    When I copy and pasted this data into excel. It must have made all the numbers labels. Now I can not create formulas. I thought all the numbers where text and I tried converting them by multiplying by one. It has not worked so I concluded that the numbers must be labels. I can not find any information on how to convert them.


    This is really not a VBA question. However I know that if you know VBA you will no how to fix this.

    Thanks in Advise for helping. It will be really helpful to know how to fix this problem in the future.
    Attached Files Attached Files

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    You have trailing space characters so they have to be removed. e.g.
    [VBA]Sub Trim()
    Dim cell As Range
    For Each cell In Selection
    cell.Value2 = Trim(cell.Value2)
    cell.NumberFormat = "#,##0"
    Next cell
    End Sub[/VBA]

  3. #3
    That does not seem to work. I get an error. Wrong number of arguements.

  4. #4
    Ok I ran this macro an the code was executed. However, the numbers in the cell must be a label. I still can not create formulas.

    [vba]Sub CleanSheet1()
    Dim Cell As Range
    For Each Cell In Sheet1.UsedRange
    Cell.Value = Trim(Cell)
    Next Cell
    End Sub[/vba]

    Last edited by Aussiebear; 03-10-2011 at 03:09 PM. Reason: added VBA Tags to code

  5. #5
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,054
    Location
    I am able to construct formulas within your spreadsheet on my system. When you copied and pasted, did you use paste special or just paste? Please note that the code you supplied only works on sheet 1 ("Income Statement") of the workbook, so you will need to adjust this to work on all of the sheets.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

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