+ Reply to Thread
Results 1 to 4 of 4

Macro for trim forumla/ convert text to numbers

  1. #1
    Registered User
    Join Date
    11-26-2015
    Location
    Bradford, England
    MS-Off Ver
    Microsoft excel 2010
    Posts
    13

    Red face Macro for trim forumla/ convert text to numbers

    Hi, I’m new to vba/Macros and I wonder if any one could please help with the VBA code for this.
    I have two sheets, Sheet1 and Sheet2.
    Sheet 1 has an undetermined number of rows and will vary weekly
    Sheet 1 has 16 columns
    Sheet 2 has an undetermined number of rows and will vary weekly
    Sheet 2 has 11 columns
    I need a Macro which will do the follow steps.
    On sheet 1:
    Trim column A (Remove all spaces from a text string for all rows in this column – I would typically use ‘Trim’ formula for this when doing it manually)
    Trim column B (Remove all spaces from a text string for all rows in this column – I would typically use ‘Trim’ formula for this when doing it manually)
    On sheet 2:
    Trim column A (Remove all spaces from a text string for all rows in this column – I would typically use ‘Trim’ formula for this when doing it manually)
    Trim column C (Remove all spaces from a text string for all rows in this column – I would typically use ‘Trim’ formula for this when doing it manually)
    Column K – Numbers are stored as text. I need to convert to number format and remove leading zeros for all entries in that column.
    And that’s it! If anyone could help that would be great! I’m trying to get VBA to assist me with what I’m trying to do and then teach myself by breaking down the individual steps.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macro for trim forumla/ convert text to numbers

    Hi,

    Would you upload the workbook so that we can test a solution in context.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Macro for trim forumla/ convert text to numbers

    See if this works.
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-26-2015
    Location
    Bradford, England
    MS-Off Ver
    Microsoft excel 2010
    Posts
    13

    Re: Macro for trim forumla/ convert text to numbers

    Amazing! Thankyou so much!!! :D

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro to convert text/numbers to numbers
    By k_paresh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-26-2014, 10:58 AM
  2. macro to convert text to numbers on multiple sheets
    By ufopilot in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2014, 10:52 AM
  3. [SOLVED] Convert numbers stored as text to numbers for range of data that changes
    By excel2425 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-06-2014, 01:57 PM
  4. [SOLVED] Convert all numbers stored as text or custom formatted to numbers &no decimals - 40 sheets
    By synses in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-19-2013, 01:46 AM
  5. [SOLVED] How do you apply the int() in VBA in order to convert numbers stored as text to numbers
    By djaurit in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-21-2012, 02:57 PM
  6. Problem creating a macro to convert numbers which are stored as text
    By LemonTwist in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-12-2012, 02:28 AM
  7. trim text from numbers
    By wtcamb in forum Excel General
    Replies: 4
    Last Post: 04-19-2011, 05:26 PM
  8. Having macro convert text to numbers
    By punter in forum Excel General
    Replies: 3
    Last Post: 06-13-2006, 06:58 AM

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