Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

VB.Net - Excel Formatting Issue From VB6 Conversion

Good Day Experts!

I am having an issue when the formatting routine executes against the Excel spreadsheet that is created by this application. It is a VB6 program that I ran the conversion on.  I have not made any code changes to this formatting routine.  

Here is the line thatI am getting the error on:
If exlWS.Cells(x, 7) <> "" Then exlWS.Cells(x, 7) = CDec(exlWS.Cells(x, 7))

I attached the pop-up error message box.

Thanks,
jimbo99999
0
Jimbo99999
Asked:
Jimbo99999
  • 3
  • 3
2 Solutions
 
nmarunCommented:
I'm not seeing the attachment. Also let me know what data you are trying to convert to a decimal.

Arun
0
 
Jimbo99999Author Commented:
0
 
nmarunCommented:
Try
exlWS.Cells(x, 7).ToString <> ""

Arun
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Jimbo99999Author Commented:
Ok, that got me past the first part and now on the ...Then exlWS.Cells(x, 7) = CDec(exlWS.Cells(x, 7)) I get an error:

Conversion from type 'Range' to type 'Decimal' is not valid.
0
 
nmarunCommented:
Again, try CDec(exlWS.Cells(x, 7).ToString)

Arun
0
 
CodeCruiserCommented:
Either use ToString or use .Value

CDec(exlWS.Cells(x, 7).Value)
0
 
Jimbo99999Author Commented:
Working now...thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now