After formatting with Visual Basic, the Excel formula doesn't work

pecsenye

New Member
Joined
Jan 17, 2023
Messages
14
Hello everyone,

There is text copied from a website in cell A1. For example: 0:1 (1:0). I only need the first two numbers. Therefore, the value of B1 should be 0, and the value of C1 should be 1. The problem is that if I use a formula in column D1, it doesn't work with these values. (If I manually enter the same value, then everything is fine). Is there a solution for this? Do I need a different Visual Basic code?

01.jpg


Thanks for helping!
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Are you using the LEFT() function in B1:C1? If so, those return text values, and that is why your logic condition does not work. You are trying to compare "0" (text) to 0 (number). If you are not using the LEFT() function, could you show what formula you do have in B1:C1? Or explain exactly how you are formatting those values with VBA.
 
Upvote 0
Do I need a different Visual Basic code?
It might help if you posted the VBA code ;)

To add to post 2
I suspect that B1 has a Number Stored as Text error as it is showing an error triangle, does it?
If there is a formula in B1 try putting a +0 at the end of the formula
 
Upvote 0
I can solve it both with and without a formula, so adding '+0' to the end of the formula is a good solution! I didn't know about this 'trick'. Thank you very much, everyone! MARK858, your solution works for me, thank you!
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top