Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 200
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

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