Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7870601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:39:59+00:00 2026-06-03T01:39:59+00:00

I have a large Excel sheet auto generated from C#, which outputs all columns

  • 0

I have a large Excel sheet auto generated from C#, which outputs all columns as text (this cannot be changed for technical reasons). I am having trouble writing a macro which will convert the numeric columns to numbers, and do it fast (the sheet contains 80 columns and 20,000 rows).

I have tried iterating over all cells and calling

If IsNumeric(cell.Value) Then cell.Value = CDec(cell.Value)

This is very slow AND has the additional problem that I have a special case where strings starting with things such as “0xxx” need to be kept as a string. If I used IsNumeric and then convert to CDec, I LOSE the leading 0!

Is there some simple trick to say detect if one value in a column is a string, then do NOT process the column, else convert them to numeric EXCEPT for the case where we have a leading 0?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T01:40:00+00:00Added an answer on June 3, 2026 at 1:40 am

    Does storing the value in memory and doing your checking work? Something similar to the below code, but you would have to refine it and replace condition_is_true for something meaningful. I would use a function to return back a boolean.

    Dim input_var As String
    
    For r = 1 To 20000
        For c = 1 To 80
            input_var = Sheet1.Cells(r, c).value
            'do some stuff to the string
    
            If condition_is_true Then
                Sheet1.Cells(r, c).value = CDec(input_var)
            Else
                Sheet1.Cells(r, c).value = input_var
            End If
        Next c
    Next r
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large column of data in Excel. This data should all be
I have a fairly large Excel file. In this file there is a column
I have a large table I imported from an Excel spreadsheet. For five of
I have a large excel document that is generated when the user clicks on
I have added a table from Excel to Word. The table is too large
I am reading a large amount of data from an excel spreadsheet in which
I have a client who needs to import rows from a LARGE Excel file
We have a few very large Excel workbooks (dozens of tabs, over a MB
I have long HTTP request ( generating large Excel file - about 60K records
I have a large collection of data in an excel file (and csv files).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.