+ Reply to Thread
Results 1 to 6 of 6

Number Stored as Text -> Convert to Number

  1. #1
    Registered User
    Join Date
    10-28-2019
    Location
    Iowa
    MS-Off Ver
    2019
    Posts
    7

    Number Stored as Text -> Convert to Number

    Hello, I am attempting to record a macro for a project of mine. One issue I have is that the data I am working with gets pulled from SAP and the numbers I need to use a match function initially have the error "Number Stored as Text." In order for the match function to work, I highlight the entire columns with this error and just click Convert to Number. I have attached a picture of this error. When I do this while recording a macro, it does not work on a new file.

    I have 3 columns that I need to do this transformation on. This is what I currently have below. It works if I break it up and perform on one sheet at a time. But when I attempt to do it all at once, I get the error "Select Method of Range Class Failed."

    Please Login or Register  to view this content.
    I realize there may be a simple fix for this, I am pretty inexperienced with VBA and appreciate all the help. Thanks.
    Attached Images Attached Images
    Last edited by ppayjj; 11-26-2019 at 01:02 PM.

  2. #2
    Forum Contributor
    Join Date
    11-05-2019
    Location
    Tiki Island, TX
    MS-Off Ver
    Office 365
    Posts
    168

    Re: Number Stored as Text -> Convert to Number

    You are converting columns H, T, and R. The code you have is careful to make the conversion on a specific named worksheet on the second two macros converting columns T and R. The macro to convert column H is not specific and more general. You mentioned you are trying to change it on multiple sheets all at once. Can I clarify? Are you wanting to change the same columns on sheets with multiple names? Are you wanting to just highlight the columns you want to convert on the current worksheet and convert them? Are you trying wanting to highlight the same column but on different sheets to convert them?

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,522

    Re: Number Stored as Text -> Convert to Number

    @ ppayjj

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Registered User
    Join Date
    10-28-2019
    Location
    Iowa
    MS-Off Ver
    2019
    Posts
    7

    Re: Number Stored as Text -> Convert to Number

    There are 3 columns that need to be changed, on two different sheets. Column H on the first sheet, and columns T and R on the other sheet. The one for column H is on the first datasheet and the one that is opened automatically so I did not specify that sheet. I know that the "select" command on VBA is quite infamous and is most likely the source of my problems, but I am unsure of any other way to do it.

    Thanks again.

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

    Re: Number Stored as Text -> Convert to Number

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

  6. #6
    Forum Contributor
    Join Date
    11-05-2019
    Location
    Tiki Island, TX
    MS-Off Ver
    Office 365
    Posts
    168

    Re: Number Stored as Text -> Convert to Number

    Often the problem can be solved by activating the worksheet you want to work on. Give this a try:
    Please Login or Register  to view this content.

+ 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. [SOLVED] VBA convert number stored as text to number
    By Littlesimon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-21-2017, 09:54 PM
  2. [SOLVED] Text stored as number when copied from one sheet to another, Auto convert required
    By A440 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-06-2016, 09:06 AM
  3. Macro - Convert stored text to number
    By adste89 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-19-2013, 09:19 AM
  4. Replies: 1
    Last Post: 10-28-2012, 05:42 AM
  5. Convert Excel cells stored as text to date and number coming from notepad
    By Fire_d in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-31-2010, 12:34 AM
  6. [SOLVED] how do i convert a number stored as text to a numb in a vba loop
    By bobm in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-27-2010, 05:06 AM
  7. Number stored as text. How do I keep the number format?
    By staying in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-13-2006, 11:57 PM

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